/* Copyright 2000-2005, Intuit Inc.  All rights reserved. 
This material contains proprietary information of Intuit Inc. 
Use, reproduction or distribution without express written permission of an 
authorized representative of Intuit Inc. is prohibited. */

////////////////////////////////////////////////////////////////////////////////
// Utility functions
////////////////////////////////////////////////////////////////////////////////
/* MM_swapImgRestore() - to be used to load hover images in menu back to normal state */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
/* MM_preloadImages() - to be used to preload mouseover images for the top navigation */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
/* MM_findObj(n, d) - used by the swap function utilities */
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
/* MM_swapImage() - to be used to load hover images in menu */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/* LoadVarSizedWin - creates a window with specified height and width. If there is an existing window opened using this function, the new URL called will be opened on the same window */	
function LoadVarSizedWin(vURL, vwidth, vheight){
	try {
		var win_newwin=null;	
		if (window.screen.availHeight && (vURL.indexOf('screen_contact_us.cfm') != -1 || vURL.indexOf('custhelp.com',vURL) != -1 || vURL.indexOf('answers.cfm') != -1 )) {
			if (window.screen.availHeight > vheight) {
				var height_attr=",height=" + window.screen.availHeight + "'";
			} else {
				var height_attr=",height=" + vheight + "'";
			}
		} else {
			var height_attr=",height=" + vheight + "'";
		}
		if (!win_newwin) {
			 win_newwin=window.open(vURL, 'win_newwin', 'width=' + vwidth+  height_attr+ ',status=yes,resizable=yes,scrollbars=yes,top=0,left=0')
			//win_newwin=window.open(vURL, 'win_newwin', 'width=' + vwidth+ ',height=' + vheight+ ',status=yes,resizable=yes,scrollbars=yes');
		}
		win_newwin.focus();	
    } catch (e) {}
}

/* LoadVarSizedWinNew - creates a window with specified height and width. If there is an existing window opened using this function, the new URL called will be opened on a new window */	
function LoadVarSizedWinNew(vURL, vwin_newwin, vwidth, vheight){
	try {
		width=vwidth;
        height=vheight;
		var left=Math.floor(screen.width/2 - width/2);
        var top=Math.floor(screen.height/2 - height/2);	
		vwin_newwin=window.open(vURL, vwin_newwin, 'width=' + vwidth+ ',height=' + vheight+ ',status=yes,resizable=yes,scrollbars=yes,toolbar=no,location=no,menubar=no,left=' + left + ',top=' + top);
		vwin_newwin.focus();		
	} catch (e) {}
}	

/* LoadNewVarSizedWin - creates a NEW window with specified height and width with tool, url and menu bars */
function LoadNewVarSizedWin(vURL, vwindowname, vwidth, vheight){
	try {
		vwindowname=window.open(vURL, vwindowname, 'width=' + vwidth+ ',height=' + vheight+ ',status=yes,resizable=yes,scrollbars=yes,toolbar=yes,location=yes,menubar=yes');
		vwindowname.focus();		
	} catch (e) {}
}			

function LoadSupportWin(call_type){
	try {
		var win_support; 
		win_support=window.open('https://'+ document.ugt_server_var + "/"+ call_type, 'win_support', 'height=450,width=662,status=no,resizable=yes,scrollbars=yes');
		win_support.focus();
	} catch (e) {}
}		

function LoadModalWindow(url, vheight, vwidth){
	try {
		var windowTop=new Array();
		windowTop.opener=top;					
		window.showModalDialog(url, windowTop, 'dialogHeight:' + vheight+ 'px;dialogWidth:' + vwidth+ 'px;center:yes; help:no; status:no; resizable:no;');
	} catch (e) {}
}		

function getElementPosition(elemID) {
	
   var offsetTrail=document.getElementById(elemID);
   var offsetLeft=0;
   var offsetTop=0;
   
   // loop to the top    
   while (offsetTrail) {
       offsetLeft += offsetTrail.offsetLeft;
       offsetTop += offsetTrail.offsetTop;
       offsetTrail=offsetTrail.offsetParent;
   }
   
   if (navigator.userAgent.indexOf("Mac") != -1 && 
       typeof document.body.leftMargin != "undefined") {
       offsetLeft += document.body.leftMargin;
       offsetTop += document.body.topMargin;
   }
   return {left:offsetLeft, top:offsetTop};
}

////////////////////////////////////////////////////////////////////////////////
// Application functions
////////////////////////////////////////////////////////////////////////////////


function hidePopupAnswer(divID) {
	
	objDiv=document.getElementById(divID); 	
	objDiv.style.display="none"; 	
	
	var shadow=document.getElementById('popupshadow');
	var pointer=document.getElementById('pointer');
	var pointerImg=document.getElementById('pointerImg');
	var pointerShadow=document.getElementById('pointerShadow');
	
	shadow.style.display="none";
	pointer.style.display="none";
	pointerShadow.style.display="none";
	
}

///////////////////////////////////////////
// new popup 2/9/2006 mstraka  
////////////////////////////////////////
function showPopupAnswer(divID, hrefID, setWidth){
	// close all other answers popups 
	var collDiv=document.getElementsByTagName("DIV"); 
	var strID=new String(); 
	
	for (i=0; i < collDiv.length; i++) {		
		if (typeof collDiv[i].id != "undefined") {
			strID=collDiv[i].id; 
		}
		else {
			strID=""; 
		}		
		if ((strID.indexOf("ans") != -1) && (typeof collDiv[i].style.display != "undefined") && (collDiv[i].style.display == "block")) {
			collDiv[i].style.display="none";
		} 
	}
	//get elements.
	var shadow=document.getElementById('popupshadow');
	var pointer=document.getElementById('pointer');
	var pointerImg=document.getElementById('pointerImg');
	var pointerShadow=document.getElementById('pointerShadow');

	thelink=document.getElementById(hrefID);
	popupBox=document.getElementById(divID); 
	
	//width is an optional argument
	if(setWidth){
	 popupBox.style.width=setWidth+'px';
	}
	else {
	 popupBox.style.width='210px';
	}
	
	//adjust shadow location for Firefox 
	var IE=document.all?true:false;
	var fireFoxAdj=0;
	if(!IE){ fireFoxAdj=5; }
	
	if(popupBox.style.display == "block"){
		popupBox.style.display="none";
		shadow.style.display="none";
		pointer.style.display="none";
		pointerShadow.style.display="none";
	}
	else {
	//first size the shadow
		popupBox.style.display="block";
		shadow.style.display="block";
		pointer.style.display="block";
		pointerShadow.style.display="block";
	
		var popup_wdth=popupBox.clientWidth;
		var popup_ht=popupBox.clientHeight;
		
		shadow.style.width=eval(popup_wdth + 14)+'px';
		shadow.style.height=eval(popup_ht + 14)+'px';

		var linkPos=new Object(); 
		linkPos=getElementPosition(hrefID);
		
		//var link_tp=thelink.offsetTop;
		var link_tp=linkPos.top;
		//var link_lft=thelink.offsetLeft;
		var link_lft=linkPos.left;
		var link_wdth=thelink.offsetWidth;
		
		var pointer_wdth=pointerImg.width;
		//setting the left edge of the popup
		var setLeft=link_lft + link_wdth + pointer_wdth - 9;

		var body_wdth=document.body.clientWidth;
		var body_ht=document.body.clientHeight;
		var pointing='left'; //be default the popup is to the right of the link, pointing left
		var pointVert='up';  //by defautl the popup arrow is pointing up
		
		//switch popup to the left if link is too close to right edge of page 
		//OR if it is too close to the left		
		
		//originally 				
		// if((500 < (setLeft + popup_wdth + pointer_wdth + 4)) && (link_lft > 280)){
		if(setLeft > 500){
			
			pointing='right';
			if ((link_lft - popup_wdth - pointer_wdth - 180) < 0){
				setLeft=link_lft; 	 
			} else {
				setLeft=link_lft - popup_wdth - pointer_wdth - 180;			
			}
			
		} else { 
			pointing='left';
			setLeft=link_lft;
		}
		var halfHeight=popup_ht/2;
		var halfHeight=Math.round(halfHeight);
		
		var setTop=link_tp - halfHeight;
		if ((setTop + popup_ht) > body_ht){
				setTop=link_tp - popup_ht + 10;//keep popup bottom above the bottom of the frame
				pointVert='down'; //since we are at the bottom edge of the frame, point the arrow down to the link
		}
		//keep popup top below the top of the frame
		if (setTop < 205) {
			setTop=205; 
			link_tp=305;		
		}		
		var setLeftShad=setLeft-7;
		var setTopShad=setTop-7;
		
		popupBox.style.left=setLeft+'px';
		popupBox.style.top=setTop+'px';
		shadow.style.left=setLeftShad+fireFoxAdj+'px';
		shadow.style.top=setTopShad + fireFoxAdj+'px';

		//position pointer 
		// var pointer_top=link_tp+7;
		var pointer_top=link_tp+7;
		var pointer_left;
		var pointer_shadow_left_offset=-7;
		var pointer_shadow_top_offset=-7;;
		if (pointing == 'right'){
			if(pointVert == 'up'){
				pointer_left=setLeft + popup_wdth -1; //left edge of popup + width of popup -1;
				pointerImg.src="/qbo/images/_bb/popup_rt_wedge_up_white.gif";
				pointerShadow.src="/qbo/images/_bb/popup_rt_wedge_up_black.gif";
				pointer_shadow_left_offset=-5;
				pointer_shadow_top_offset=-5;
			}
			else {//right down
				pointer_left=setLeft + popup_wdth -1; //left edge of popup + width of popup -1;
				pointerImg.src="/qbo/images/_bb/popup_rt_wedge_down_white.gif";
				pointerShadow.src="/qbo/images/_bb/popup_rt_wedge_down_black.gif";
				pointer_top=link_tp - pointerImg.height;
				pointer_shadow_left_offset=-11;
				pointer_shadow_top_offset=-26;
			}
		}
		else { //pointing left
			if(pointVert == 'up'){
				pointer_left=setLeft - pointer_wdth + 1; //left edge of poput - width of image + 1
				pointerImg.src="/qbo/images/_bb/popup_lft_wedge_up_white.gif";
				pointerShadow.src="/qbo/images/_bb/popup_lft_wedge_up_black.gif";
				pointer_shadow_left_offset=-6;
				pointer_shadow_top_offset=-5;
			}
			else { //left down
				pointer_left=setLeft - pointer_wdth + 1; //left edge of poput - width of image + 1
				pointerImg.src="/qbo/images/_bb/popup_lft_wedge_down_white.gif";
				pointerShadow.src="/qbo/images/_bb/popup_lft_wedge_down_black.gif";
				pointer_top=link_tp - pointerImg.height;
				pointer_shadow_left_offset=-15;
				pointer_shadow_top_offset=-25;
			}
		}
		pointer.style.left=pointer_left+'px';
		pointer.style.top=pointer_top+'px';		
		pointerShadow.style.left=eval(pointer_left + pointer_shadow_left_offset + fireFoxAdj)+'px';
		pointerShadow.style.top=eval(pointer_top + pointer_shadow_top_offset + fireFoxAdj)+'px';
		pointerShadow.style.width=eval(pointerImg.width + 16) + 'px';
		pointerShadow.style.height=eval(pointerImg.height + 28) + 'px';
	}
}


/////////////////////////////////////////
///show popup for features page
/////////////////////////////////////////

	// var windowWidth=document.documentElement.clientWidth;
	// var windowHeight=document.documentElement.clientHeight;
	var windowWidth=3000;
	var windowHeight=3000;	
	$(document).ready(function(){
		$("#popupDialog").css({ "height": windowHeight });
		$("#popupDialog").css({ "width": windowWidth });
	}
	)
	function showPopup(){
		$("#popupDialog").css({   "opacity": "0.3"  });  
		$("#popupDialog").fadeIn("slow");
		$("#popupDialog").css({  
			"height": windowHeight
		}); 
	}
	function hidePopup(){
		$("#popupDialog").fadeOut("slow")
	}

///////////////////////////////////////////
// grey popup 
////////////////////////////////////////
function hideGreyPopupAnswer(divID) {
    
    objDiv=document.getElementById(divID);    
    objDiv.style.display="none";  
    
}

///////////////////////////////////////////
// new popup 2/9/2006 mstraka  
////////////////////////////////////////
function showGreyPopupAnswer(divID, hrefID, setWidth){
    // close all other answers popups 
    var collDiv=document.getElementsByTagName("DIV"); 
    var strID=new String(); 
    
    for (i=0; i < collDiv.length; i++) {        
        if (typeof collDiv[i].id != "undefined") {
            strID=collDiv[i].id; 
        }
        else {
            strID=""; 
        }       
        if ((strID.indexOf("ans") != -1) && (typeof collDiv[i].style.display != "undefined") && (collDiv[i].style.display == "block")) {
            collDiv[i].style.display="none";
        } 
    }
    thelink=document.getElementById(hrefID);
    popupBox=document.getElementById(divID); 
    
    //width is an optional argument
    if(setWidth){
     popupBox.style.width=setWidth+'px';
    }
    else {
     popupBox.style.width='210px';
    }
    
    //adjust shadow location for Firefox 
    var IE=document.all?true:false;
    var fireFoxAdj=0;
    if(!IE){ fireFoxAdj=5; }
    
    if(popupBox.style.display == "block"){
        popupBox.style.display="none";
    }
    else {
    //first size the shadow
        popupBox.style.display="block";
    
        var popup_wdth=popupBox.clientWidth;
        var popup_ht=popupBox.clientHeight;

        var linkPos=new Object(); 
        linkPos=getElementPosition(hrefID);
        
        //var link_tp=thelink.offsetTop;
        var link_tp=linkPos.top;
        //var link_lft=thelink.offsetLeft;
        var link_lft=linkPos.left;
        var link_wdth=thelink.offsetWidth;
        
        //setting the left edge of the popup
        var setLeft=link_lft + link_wdth + 20;

        var body_wdth=document.body.clientWidth;
        var body_ht=document.body.clientHeight;
        
        //switch popup to the left if link is too close to right edge of page 
        //OR if it is too close to the left     
        
        //originally                
        // if((500 < (setLeft + popup_wdth + pointer_wdth + 4)) && (link_lft > 280)){
		// alert(setLeft);
		 
		//check if popup should be positioned to the left of the link
		if(((setLeft + popup_wdth > body_wdth) && (link_lft - popup_wdth > 100)) //if popup is off screen (requiring side scroll)
				|| ((setLeft + popup_wdth > 1220) && (body_wdth > 1200 && body_wdth <= 1400)) //if screen is wide
				|| ((setLeft + popup_wdth > 1320) && (body_wdth > 1400 && body_wdth <= 1600)) //if screen is wider
				|| ((setLeft + popup_wdth > 1400) && (body_wdth > 1600))) //if screen is really wide
		{  
			setLeft=link_lft - popup_wdth;
        }
		// alert(setLeft);
        var halfHeight=popup_ht/2;
        var halfHeight=Math.round(halfHeight);
        
        var setTop=link_tp - halfHeight;
        if ((setTop + popup_ht) > body_ht){
                setTop=link_tp - popup_ht + 10;//keep popup bottom above the bottom of the frame
                pointVert='down'; //since we are at the bottom edge of the frame, point the arrow down to the link
        }
        //keep popup top below the top of the frame
        if (setTop < 205) {
            setTop=205; 
            link_tp=305;      
        }       
        
        popupBox.style.left=setLeft+'px';
        popupBox.style.top=setTop+'px';
    }
}
//New function for Payroll interstitial
//dcrossley 6/1/2010

function showInterrupt_Alt(skuname, popup_id){
	showPopup();
	
	var divID = 'ansPayrollBundle' + skuname + popup_id;
	
	$(".popup_outer_box:visible").css("display","none");
	popupBox=document.getElementById(divID); 
		
	var yHeight = getInnerHeight();
	var offset = getScrollOffset();
	
	var midY = (yHeight/2)+offset-100;
	var midX = getScreenCenterX()-250;
	
	popupBox.style.display="block";
	popupBox.style.top = midY+'px';
	popupBox.style.left = midX+'px';
}

///////////////////////////////////////////
// showInterrupt - used in the payroll bundle popup. hide shadows and pointers
// legacy
////////////////////////////////////////
function showInterrupt(divID, hrefID){
	// close all other answers popups 
	var collDiv=document.getElementsByTagName("DIV"); 
	var strID=new String(); 
	
	for (i=0; i < collDiv.length; i++) {		
		if (typeof collDiv[i].id != "undefined") {
			strID=collDiv[i].id; 
		}
		else {
			strID=""; 
		}		
		if ((strID.indexOf("ans") != -1) && (typeof collDiv[i].style.display != "undefined") && (collDiv[i].style.display == "block")) {
			collDiv[i].style.display="none";
		} 
	}
	//get elements.
	// thelink=document.getElementById(hrefID);
	popupBox=document.getElementById(divID); 	

	//adjust shadow location for Firefox 
	// var IE=document.all?true:false;
	// var fireFoxAdj=0;
	// if(!IE){ fireFoxAdj=5; }
	
	if(popupBox.style.display == "block"){
		popupBox.style.display="none";
	}
	else {	
		var yHeight = getInnerHeight();
		var offset = getScrollOffset();
		
		var midY = (yHeight/2)+offset-100;
		var midX = getScreenCenterX()-200;

		popupBox.style.display="block";
		popupBox.style.top = midY+'px';
		popupBox.style.left = midX+'px';
	} 
}

///////////////////////////////////////////
// hideInterrupt - used in the payroll bundle popup. hide shadows and pointers
////////////////////////////////////////
function hideInterrupt(divID) {	
	objDiv=document.getElementById(divID); 	
	objDiv.style.display="none"; 	
}

///////////////////////////////////////////
// showFAQ - used to set visibility and link colors on FAQ
////////////////////////////////////////
function showFAQ(quesID,divID) {

    // check if we're just closing it
    closeFlag=false;

    // close all other FAQ popups 
    var collDiv=document.getElementsByTagName("DIV"); 
    var strID=new String(); 
	// alert(collDiv.length + collDiv[40].id);
    
    for (i=0; i < collDiv.length; i++) {        
        if (typeof collDiv[i].id != "undefined") {
            strID=collDiv[i].id; 
        }
        else {
            strID=""; 
        }       
        if ((strID.indexOf("faq") != -1) && (typeof collDiv[i].style.display != "undefined") && (collDiv[i].style.display == "block")) {
            collDiv[i].style.display="none";
            // if the quesID/divID combination is the same as the active combo, then it's a CLOSE function, and we'll skip the last two steps
            if (collDiv[i].id == divID)
            {
              document.getElementById(quesID).firstChild.src="/qbo/images/plus.png";
              closeFlag=true;
            }
        } 
    }

    // re-color all other FAQ questions
    var collAnchor=document.getElementsByTagName("IMG"); 
    var strID=new String(); 
    
    for (i=0; i < collAnchor.length; i++) {        
        if (typeof collAnchor[i].id != "undefined") {
            strID=collAnchor[i].id; 
        }
        else {
            strID=""; 	
        }       
         if (strID.indexOf("qImage") != -1) {
            collAnchor[i].src="/qbo/images/plus.png";
        } 
    }
    
    if (!closeFlag)
    {
      //document.getElementById(quesID).style.color="#666666";
      document.getElementById(divID).style.display="block";
      document.getElementById(quesID).firstChild.src="/qbo/images/minus.png";
    }   
}
function AutoResizeWindow(){
	try {
		if (window.parent.resize_iframe != null) {
			window.parent.resize_iframe();
		}	
	} catch (ignored) {}
}
///////////////////////////////////////////
//toggleFAQ - used to set visibility and link colors on FAQ
////////////////////////////////////////
function toggleFAQ(questionID, answerID) {

	var answer = document.getElementById(answerID);
	var question = document.getElementById(questionID);
	
	if (answer.style.display == 'none')
	{
		answer.style.display = 'block';
		question.src="/qbo/images/minus.png";
	}
	else
	{
		answer.style.display = 'none';
		question.src="/qbo/images/plus.png";
	}
}
/* old bcs replaced for Payroll price increase 2/4/10
var bc_for_free = 'QBF-5CL';
var bc_for_basic = 'QBB-TN9';
var bc_for_plus = 'QBP-T3S';
var bc_for_basic_with_payroll = 'QBB-T9P';
var bc_for_plus_with_payroll = 'QBP-TNP';
// used for v241 Lineup Test
var bc_for_qbo = 'QBP-TQB';
var bc_for_qbo_with_payroll = 'QBP-TQP';
var bc_for_standard = 'QOE-T19';
var bc_for_standard_with_payroll = 'QOE-T1B';
var bc_for_essential = 'QBP-T24';
var bc_for_essential_with_payroll = 'QBP-T2P';
var bc_for_premium = 'QBP-TPR';
var bc_for_premium_with_payroll = 'QBP-TPP';
*/
//new bcs for payroll price increase 2/4/10
var bc_for_free = 'QBF-5CF';
var bc_for_basic = 'QBB-PND';
var bc_for_plus = 'QBP-T3A';
var bc_for_basic_with_payroll = 'QBB-T9A';
var bc_for_plus_with_payroll = 'QBP-PBD';
// used for v241 Lineup Test
var bc_for_qbo = 'QBP-TBP';
var bc_for_qbo_with_payroll = 'QBP-TQ2';
var bc_for_standard = 'QOE-PND';
var bc_for_standard_with_payroll = 'QOE-PBD';
var bc_for_essential = 'QBP-T2E';
var bc_for_essential_with_payroll = 'QBP-T2D';
var bc_for_premium = 'QBP-TPD';
var bc_for_premium_with_payroll = 'QBP-TPB';

var sc = "";

function updateSuccessURL(successURL){
	var sessionId = mboxFactoryDefault.getSessionId().getId();

	
	if(sessionId.length > 0 && successURL.indexOf('mboxSession') == -1)
		successURL += '&mboxSession=' + sessionId;
	
	
	return successURL.replace("search.","").replace("quickbooksonline.com","quickbooksonline.intuit.com");
	
	
}

function TryQBO(prod) {
	a = "https://" + window.location.hostname + "/start/login.jsp?qboVariant=default&bc=";
	switch (prod) {
		case 'F':
			a = a + bc_for_free;
			break;
		case 'B':
			a = a + bc_for_basic;
			break;
		case 'P':
			a = a + bc_for_plus;
			break;
		case 'BP':
			a = a + bc_for_basic_with_payroll;
		break;
		case 'PP':
			a = a + bc_for_plus_with_payroll;
			break;
		// used for v241 Lineup Test
		case 'Q':
			a = a + bc_for_qbo;
			break;
		case 'QP':
			a = a + bc_for_qbo_with_payroll;
			break;			
		case 'S':
			a = a + bc_for_standard;
			break;
		case 'SP':
			a = a + bc_for_standard_with_payroll;
			break;
		case 'E':
			a = a + bc_for_essential;
			break;
		case 'EP':
			a = a + bc_for_essential_with_payroll;
			break;
		case 'M':
			a = a + bc_for_premium;
			break;
		case 'MP':
			a = a + bc_for_premium_with_payroll;
			break;										
	} 
	/*if (sc.length > 0) {
		a = a + "&sc=" + sc
	}*/
	document.location.href = updateSuccessURL(a);
}
/* showPayrollInterrupt - use this function to siplify payroll interstitial calls 
	skuname - is the name of the sku i.e. Basic, Plus, QBO, Standard, Essential, Premium
	popup_id - is the position of the popup, some pages like Products and Pricing have 2 calls to action */
function showPayrollInterrupt(skuname, popup_id){
	try{ 
		showPopup(); showInterrupt('ansPayrollBundle' + skuname + popup_id,'qPayrollBundle' + skuname + popup_id);
	}catch(e){}
	
}
/* fxnAppendSEMCookie - use to append the SEM cookie into billing manager links, 
	primarily created for the v241 lineup test. Only append document.qbo_sem when it is defined. 
	Otherwise, simply pass the source code as "a" parameter */
function fxnAppendSEMCookie(source_code) {
	try{
    	var anchorTags = document.getElementsByTagName('a');
        for(var i = 0; i < anchorTags.length; i++) {
        	if(anchorTags[i].href.indexOf('billingmanager') != -1 || anchorTags[i].href.indexOf('pharos') != -1){
            	var glue = (anchorTags[i].href.indexOf('?') == -1) ? '?' : '&';
				if (document.qbo_sem!=""){
            		anchorTags[i].href += glue + document.qbo_sem.replace('sc=BNR-', 'sc=' + source_code + '-BNR-');
				} else {
					anchorTags[i].href += glue + 'a=' + source_code;
				}
				if (document.db == "ssPTC" || document.db == "ssQA"){
					anchorTags[i].href = anchorTags[i].href.replace('https://billingmanager.intuit.com/billing/welcome.url', 'http://host2376.pharos.intuit.com/billing/welcome.url');
				}
         	}
        }
	} catch(e){}
}
/* rsuayan 20100105 getScreenCenterY - gets the vertical center/middle of the inner screen */
function getScreenCenterY() {
	var y=0;
	y=getScrollOffset()+(getInnerHeight()/2);
	return(y);
}

/* rsuayan 20100105 getScreenCenterX - gets the horizontal center/middle of the inner screen */
function getScreenCenterX() {
	return(document.body.clientWidth/2);
}

/* rsuayan 20100105 getScreenWidth - gets the width of the inner screen */
function getScreenWidth() {
	return(document.body.clientWidth);
}	

/* rsuayan 20100105 getInnerHeight - gets the height of the page not including menus and controls */
function getInnerHeight() {
	var y;
	if (self.innerHeight){
		// all except Explorer	
		y=self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight){
		// Explorer 6 Strict Mode
		y=document.documentElement.clientHeight;
	} else if (document.body){
		// other Explorers
		y=document.body.clientHeight;
	}
	return(y);
}
/* rsuayan 20100105 getScrollOffset - gets the height of the page scrolling included */
function getScrollOffset() {
	var y;
	if (self.pageYOffset){
		// all except Explorer
		y=self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){
		// Explorer 6 Strict
		y=document.documentElement.scrollTop;
	} else if (document.body){
		// all other Explorers
		y=document.body.scrollTop;
	}
	return(y);
}

/* rsuayan 20100105 showOverlay- displays a div in the center of the page, function always looks for the center/middle 
	even if the cursor is scrolled to the middle of the screen. 
	divID is the ID of the div to overlay 
	w is the width of the div to overlay
	h is the height of the div to overlay */	
function showOverlay(divID, w, h){
	popupBox=document.getElementById(divID); 	
	//get viewport's width and height
	vpWidth=getScreenWidth(); 
	vpHeight=getScrollOffset()
	//calculate center/middle position
	try {
		setTop=(vpHeight) + (h/2);
		setLeft=(vpWidth/2) - (w/2);
		popupBox.style.left=setLeft+'px';
        popupBox.style.top=setTop+'px';
	} catch(e) {}

	if(popupBox.style.display == "block"){
		popupBox.style.display="none";
	}
	else {	
		popupBox.style.display="block";
	} 				
}

function addQBOTestVariableURL(urlID, variantName)
{
	var testURL = $("#" + urlID).val() + "&qboVariant=" + variantName;
	$("#" + urlID).val(testURL);
}