// JScript File

function PopupLib()
{
    var SMALL_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=1,width=480,height=450';
    var MEDIUM_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=1,width=640,height=480';
    var LARGE_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=1,width=800,height=600';
    
    var QUOTE_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=1,width=320,height=360';
    var PRINT_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=1';
    var CUSTOM_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=1';

    var SMALL_IFRAME_PRINT_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=0,width=480,height=450';
    var MEDIUM_IFRAME_PRINT_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=0,width=640,height=480';
    var CUSTOM_IFRAME_PRINT_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,scrollbars=0';
    
    var MARCOM_LARGE_POPUP_FEATURES = 'location=1,statusbar=1,menubar=1,toolbar=1,scrollbars=1,resizable=1,width=800,height=600';

//specialty popups

    this.OpenPopUpPrint = OpenPopUpPrint; 
    function OpenPopUpPrint(item,width,height)
    { 
        return OpenPopUpUrl(item.href, 'SB_PrintPop', CUSTOM_POPUP_FEATURES + ",width=" + width + ",height=" + height);
    }

    this.OpenIframePopUpPrintSmall = OpenIframePopUpPrintSmall; 
    function OpenIframePopUpPrintSmall(item)
    { 
        return OpenPopUpUrl(item.href, 'SB_PrintPop', SMALL_IFRAME_PRINT_POPUP_FEATURES);
    }

    this.OpenIframePopUpPrintMedium = OpenIframePopUpPrintMedium; 
    function OpenIframePopUpPrintMedium(item)
    { 
        return OpenPopUpUrl(item.href, 'SB_PrintPop', MEDIUM_IFRAME_PRINT_POPUP_FEATURES);
    }
        
    this.OpenPopUpCustomIframe = OpenPopUpCustomIframe;
    function OpenPopUpCustomIframe(item,width,height)
    {
        return OpenPopUpUrl(item.href, 'SB_Pop', CUSTOM_IFRAME_PRINT_POPUP_FEATURES + ",width=" + width + ",height=" + height);
    }
    
    this.OpenPopUpCustom = OpenPopUpCustom;
    function OpenPopUpCustom(item,width,height)
    {
        return OpenPopUpUrl(item.href, 'SB_Pop', CUSTOM_POPUP_FEATURES + ",width=" + width + ",height=" + height);
    }
    
    this.OpenPopUpFaq = OpenPopUpFaq; 
    function OpenPopUpFaq(item)
    {
        return OpenPopUpUrl(item.href, 'SB_FaqPop', SMALL_POPUP_FEATURES);
    }
   
    this.OpenPopUpFaqUrl = OpenPopUpFaqUrl;
    function OpenPopUpFaqUrl(Url)
    {
        return OpenPopUpUrl(Url, 'SB_FaqPop', FAQ_POPUP_FEATURES);
    }
    
    this.OpenPopUpQuote = OpenPopUpQuote; 
    function OpenPopUpQuote(item)
    {
        return OpenPopUpUrl(item.href, 'SB_QuotePop', QUOTE_POPUP_FEATURES);
    }
   
    this.OpenPopUpMarcom = OpenPopUpMarcom; 
    function OpenPopUpMarcom(item)
    {
        return OpenPopUpUrl(item.href, 'SB_MarcomPop', MARCOM_LARGE_POPUP_FEATURES);
    } 
    
//standard popups

    this.OpenPopUpSmall = OpenPopUpSmall; 
    function OpenPopUpSmall(item)
    {
        return OpenPopUpUrl(item.href, 'SB_SmallPop', SMALL_POPUP_FEATURES);
    }
    
    this.OpenPopUpMedium = OpenPopUpMedium; 
    function OpenPopUpMedium(item)
    {
        return OpenPopUpUrl(item.href, 'SB_MedPop', MEDIUM_POPUP_FEATURES);
    }
   
    this.OpenPopUpLarge = OpenPopUpLarge; 
    function OpenPopUpLarge(item)
    {
       var url = (typeof(item) == "object") ? item.href: item;
        return OpenPopUpUrl(url, 'SB_LargePop', LARGE_POPUP_FEATURES);
    }
  
// specialized popup functionality
    
    this.TargetOpener = TargetOpener; 
    function TargetOpener(item)
    {
    	var openerWindow;
    	
    	try
        {
        	var exists = window.opener.document;
        	openerWindow = window.opener;
        	
        	openerWindow.open(item.href,'_self');
        }
        catch (ex)
        {
        	openerWindow = window;
        	openerWindow.open(item.href,'_blank');
        }
        
	openerWindow.focus();
	return false;
    } 
    
    this.TargetParent = TargetParent; 
    function TargetParent(item)
    {
         window.parent.open(item.href,'_self');
         event.cancelBubble=true;
         event.returnValue=false;
    }
   
    this.TargetNewWindow = TargetNewWindow; 
    function TargetNewWindow(item)
    {
         window.open(item.href,'_blank');
         event.cancelBubble=true;
         event.returnValue=false;
    }
    
    this.SmartOpener = SmartOpener;
    function SmartOpener(item)
    {
    	try
    	{
    		window.opener.smartOpen(item.href);
    	}
    	catch (ex)
    	{
    		window.open(item.href,'_blank');
    	}
    }
    
//internal functions

    function OpenPopUpUrl(Url, popUpName, features)
    {
        var OpenWindow = window.open(Url, popUpName, features);
        return OpenWindow;
    }
}

var popup = new PopupLib();

