﻿
function openWin(w,h,page,s) 
	{
		var thisPlatform
		var thisBrowser
		var win
		
			
		//sniffing for browser and platform
		thisBrowser = navigator.userAgent
		thisPlatform = navigator.platform;
		
		if (thisPlatform == "MacPPC") {
			if (thisBrowser.indexOf("MSIE") != -1) {
				win=window.open(page , "POP", "width=" + w + ",height=" + h + ",left=0,top=0,toolbar=no,scrollbars=" + s)
			} else {
				win=window.open(page , "POP", "width=" + w + ",height=" + h + ",left=0,top=0,toolbar=no,scrollbars=" + s)
			}
		} else {
			win=window.open(page , "POP", "width=" + w + ",height=" + h + ",left=0,top=0,toolbar=no,scrollbars=" + s)
		}
		 
		win.focus();
	}

function openNewWindow(URLtoOpen, windowName, windowFeatures) { 
	newWindow=window.open(URLtoOpen, windowName, windowFeatures); 
}

function showHelp() {
	OpenWin = this.open('Help.aspx', 'CEHelpWindow', 
						'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,width=600,height=560');
}

function showReceipt(params, sHeight) {
	OpenWin = this.open('ReceiptPF.aspx?' + params, '',
						'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=640,'
						+ 'height=' + sHeight + ',left=100,top=24');
}

function showCoupon(params) {
	OpenWin = this.open('Coupon.aspx?' + params, '',
					    'toolbar=yes,menubar=yes,location=no,scrollbars=no,resizable=yes,width=470,height=330');
}

function showCert(params) {
	OpenWin = this.open(params, '', 
					    'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=675,height=600');
}

function showResults(params) {
	OpenWin = this.open(params, '',
						'toolbar=yes,menubar=yes,location=no,scrollbars=yes,resizable=yes,width=400,height=500');
}

function Popup(page)
{
    var OpenWin;
    OpenWin = window.open(page, '', 'toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=10,height=10');
    close();
}

function onPopup(page) {
	OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=yes,width=640,height=575,left=100,top=24");
}

function ChangeTab(pStrNewTab, pStrNewContent, pStrOldTab, pStrOldContent)
{
    // Continue if the active tab changed
    if(pStrOldTab.toLowerCase() != pStrNewTab.toLowerCase())
    {
        var lOldTab = document.getElementById(pStrOldTab);
        var lNewTab = document.getElementById(pStrNewTab);
        var lOldContent = document.getElementById(pStrOldContent);
        var lNewContent = document.getElementById(pStrNewContent);
        
        // Take care of the tabs
        if(lOldTab != null && lNewTab != null)
        {
            var lStrOldTabClass = lOldTab.className.toLowerCase();
            var lStrNewTabClass = lNewTab.className.toLowerCase();
            
            // Remove the active class from the old tab
            if(lStrOldTabClass.indexOf("activetableft") >= 0)
                lOldTab.className = lOldTab.className.replace(/activeTabLeft/gi, "");
            else if(lStrOldTabClass.indexOf("activetabright") >= 0)
                lOldTab.className = lOldTab.className.replace(/activeTabRight/gi, "");
            else
                lOldTab.className = lOldTab.className.replace(/activeTab/gi, "");
                
            // Add the active class to the new tab
            if(lStrNewTabClass.indexOf("left") >= 0)
                lNewTab.className += " activeTabLeft";
            else if(lStrNewTabClass.indexOf("right") >= 0)
                lNewTab.className += " activeTabRight";
            else
                lNewTab.className += " activeTab";
        }
        
        // Swap out the content
        if(lOldContent != null && lNewContent != null)
        {
            // Hide the old content and show the new content
            lOldContent.className = "displayNone";
            lNewContent.className = "";
        }
    }
}

function SearchHelper(pBlnShow, pTxtSearch, pLblSearch)
{
    var lObjSearchTxt;
    var lObjSearchLbl;
    var lBlnShowLabel = false;
    
    // Get the objects
    lObjSearchTxt = document.getElementById(pTxtSearch);
    lObjSearchLbl = document.getElementById(pLblSearch);

    if(lObjSearchTxt != null && lObjSearchLbl != null)
    {
        if(pBlnShow && lObjSearchTxt.value == "")
        {
            // Show the label
            lBlnShowLabel = true;
        }
    }
    
       
    if(lObjSearchLbl != null)
    {
        // Show or Hide the label
        if(lBlnShowLabel)
        {
            lObjSearchLbl.className = "searchInsideLabel";
        }
        else
        {
            lObjSearchLbl.className = "hideLabel";
        }
    }
}
 function closeGoBack(pStrReferrerUrl)
      {
        var lObjShadow = parent.document.getElementById('sb-content');        
        
        if(lObjShadow != null && typeof parent.Shadowbox != "undefined")
			parent.Shadowbox.close();
        else
        {
            if (pStrReferrerUrl != "")
                window.location.href = pStrReferrerUrl;
	        else
		        window.close();
        }
    }
function closeGoBack_Redirect(pStrUrl)
{
    var lObjShadow = parent.document.getElementById('sb-content');        
    
    if(lObjShadow != null && typeof parent.Shadowbox != "undefined")
    {
		parent.location.href = pStrUrl;
		parent.Shadowbox.close();
    }
    else
    {
        if (pStrReferrerUrl != "")
            window.location.href = pStrUrl;
        else
	        window.close();
    }
}
