
    
    
    function InsertBGem( gemClassId, bFramed, returnUrl )
    {
        var cmd;
        
        if (returnUrl){
          Set_Cookie('gem_return', returnUrl, '', '/', '');
        }
        else{
          returnUrl = Get_Cookie('gem_return');
        }
        if (bFramed == true){
          Set_Cookie('gem_class_id', gemClassId, '', '/', '');
          top.location.href = '/trellix/sitebuilder/f_gem_create.html';
        }
        else{
          cmd = 'SiteBuilderServlet';
          cmd = cmd + '?Command=GemCreate';
          cmd = cmd + '&ClassId=' + gemClassId;
          if (Get_Cookie('gem_invite') == '1')
              cmd = cmd + '&Mode=invite';
          else
              cmd = cmd + '&Mode=create';
          cmd = cmd + '&PartnerNum=114';
          cmd = cmd + '&PageNum=' + Get_Cookie('page_num');
          cmd = cmd + '&Coords=' + Get_Cookie('coords');
          if (returnUrl){
            cmd = cmd + '&fUrl=' + escape(returnUrl);		
          }
          else{
            cmd = cmd + '&fUrl=/trellix/sitebuilder/f_edit_page.html';
          }
          top.location.href =  cmd;
        }
    }
    		
    function AddPassThruGem(cmdForm)
    {
    	var returnUrl = Get_Cookie('gem_return');
    	if (!returnUrl)
    		returnUrl = '/trellix/sitebuilder/f_edit_page.html';

    	if (Get_Cookie('gem_invite') == '1')
    		cmdForm.Command.value = 'SetPassThruGemContents';
    	else
    		cmdForm.Command.value = 'InsertPassThruGem';
    
    	cmdForm.PageNum.value = Get_Cookie('page_num');
    	cmdForm.Coords.value = Get_Cookie('coords');
    	cmdForm.sUrl.value = returnUrl;
    	cmdForm.fUrl.value = returnUrl;
        
    	Delete_Cookie('coords', '/', '');
    	Delete_Cookie('gem_class_id', '/', '');
    	Delete_Cookie('gem_invite', '/', '');
    	
       	cmdForm.submit();		
    }	
    
    function UpdatePassThruGem(cmdForm)
    {
    	cmdForm.Command.value = 'SetPassThruGemContents';
    	cmdForm.PageNum.value = Get_Cookie('page_num');
    	cmdForm.Coords.value = Get_Cookie('coords');
    	cmdForm.sUrl.value = '/trellix/sitebuilder/f_edit_page.html';
    	cmdForm.fUrl.value = '/trellix/sitebuilder/f_edit_page.html';
    	    
    	Delete_Cookie('coords', '/', '');
    	
    	cmdForm.submit();	
    }	
    
    function InsertGem( gemClassId, gemClassVer )
    {
    	var cmd;
    	var returnUrl = Get_Cookie('gem_return');
    	if (!returnUrl)
    		returnUrl = '/trellix/sitebuilder/f_edit_page.html';
		else
			returnUrl = escape( returnUrl );
    
    	cmd = 'SiteBuilderServlet';
    	cmd = cmd + '?Command=InsertGem';
    	cmd = cmd + '&attClassId=' + gemClassId;
    	cmd = cmd + '&attClassVer=' + gemClassVer;
    	cmd = cmd + '&PageNum=' + Get_Cookie('page_num');
    	cmd = cmd + '&Coords=' + Get_Cookie('coords');
    	if (Get_Cookie('gem_invite') == '1')
    		cmd = cmd + '&Mode=invite';
    	else
    		cmd = cmd + '&Mode=create';
    
    	cmd = cmd + '&sUrl=' + returnUrl;
    	cmd = cmd + '&fUrl=' + returnUrl;
    
    	Delete_Cookie('coords', '/', '');
    	Delete_Cookie('gem_invite', '/', '');
    
    	top.location.href = cmd;
    }
    
    function RaiseTipsWindow(varURL)
    {
    	/* matches OpenTlxWin, valid varUrls:
    	 * mapQuestMap
    	 * mapQuest
    	 * weatherMagnet
    	 * weatherViewer
    	 * worldGuestbook
    	 * fileDownload
    	 * buildWebGem
    	 * smartAgeBanner
    	 * soundWebGem
    	 * videoWebGem
         */
		var w = 468;
        var h = 490;
         
        var xloc = (screen.width - w) / 2;
        var yloc = (screen.height - h) / 2;
         
        var settings="width="+w+",height="+h+",innerwidth="+w+",innerheight="+h+",left="+xloc+",top="+yloc +",resizable=no"
        window.open('http://support.trellix.com/sc/webGemTips/default.asp?partner=114&version=5.6&varWebGem='+varURL,"SupportCentralWin",settings);
    }
    
    
