
function viewPopup(strImgPath){
  objImg= new Image();
  objImg.src=(strImgPath);
  initOpenWindow(strImgPath);
}

function initOpenWindow(strImgPath){
  if((objImg.width!=0)&&(objImg.height!=0)){openWindow(strImgPath);}
  else {
    objInitWin="initOpenWindow('"+strImgPath+"')";
    interval=setTimeout(objInitWin,20);  
  }
}

function openWindow(strImgPath){
  objWinWidth=objImg.width; //+30;
  objWinHeight=objImg.height+20;
  strAttributes="width="+objWinWidth+",height="+objWinHeight;
  window.open('/templates/popupWindow.asp?strImageURL='+ escape(strImgPath),"",strAttributes);
}
	
function closeWindow(){
	window.self.close();	
}

function submitURL(isNewWindow, strURL){
	if (!strURL.length<1){
		if (isNewWindow) window.open(strURL)
		else window.location = strURL;
	}
	else {alert('Please make your selection and re-submit.'); return false;}
}

function setSource(strSrcId,strSrc){
	objElem = returnObj(strSrcId);
	objElem.src = strSrc;
}

function setStyle(objElemId,strClass){
	//alert(objElemId)
	objElem = returnObj(objElemId);
	objElem.className = strClass;
}

function setParentStyle(objElemId,strClass){ 
	objElemBase = returnObj(objElemId);
	
	for (i=0; i<6; i++){				
		objElemBaseTemp = objElemBase;
		objElemUpperLevel = objElemBaseTemp.parentNode;	
		if ((objElemUpperLevel) &&(objElemUpperLevel.className == 'hiddenState')) objElemUpperLevel.className = strClass;			
		if ((objElemUpperLevel.previousSibling) && (i>0 && objElemUpperLevel.previousSibling.className == 'more')) objElemUpperLevel.previousSibling.className = 'expanded';	
		objElemBase = objElemUpperLevel;		
	}	
}

function returnObj(objId){
	objElem = document.getElementById(objId);
	return objElem;
}

function setLinkPath(strElemId,strCurrentLink){
	objAnchor = returnObj(strElemId);
	objAnchor.href = strCurrentLink;
}

function setUpgradeBanner(strSrcId2,strSrc2){	
	objUpg = document.getElementById("alt").alt = "Questions? Call Us Now! 866.442.1901";	
	setSource(strSrcId2,strSrc2);			
	setStyle("alt","upgradePNImage");
	setStyle("upgradeEmail","show");	
}
