//This function is for applying dynamic CSS to article pages 
function calculatearticleIndexImgBrdrCssProperties(article) {
	if (article=='thirdarticle'){
		document.getElementById("articalcontainer").style.height=document.getElementById("articlelinks").offsetHeight+240;
		document.getElementById("articalcontainerborder").style.height=document.getElementById("articlelinks").offsetHeight+149;
		document.getElementById("whiteborder").style.height=document.getElementById("articlelinks").offsetHeight+175;
		document.getElementById("copyart").style.height=document.getElementById("articlelinks").offsetHeight+60;
		document.getElementById("articlefooter").style.top=document.getElementById("articlelinks").offsetHeight+210;
		document.getElementById("articlefooter").style.left=470;
	}else if (article=='firstarticle'){		
		document.getElementById("articalcontainer").style.height=670;
		document.getElementById("articalcontainerborder").style.height=584;
		document.getElementById("whiteborder").style.height=610;
		document.getElementById("copyart").style.height=495;
		document.getElementById("articlefooter").style.top=643;
		document.getElementById("articlefooter").style.left=470;
	}
}
function calculateMultiFormImgBrdrCssProperties() { 
  // Retrieve region div heights
  var headerHeight = document.getElementById("header").offsetHeight;
  var formHeight = null;
  if(document.getElementById("multiformImg") != null) {
  	formHeight = document.getElementById("multiformImg").offsetHeight+70;
  } else if(document.getElementById("multiformImgNoService") != null) {
  	formHeight = document.getElementById("multiformImgNoService").offsetHeight+70;
  }
  var campusLocHeight = 0;
  var copyHeight = document.getElementById("multiservicecopy").offsetHeight;
  var mainRegionHeight = copyHeight > formHeight ? copyHeight : formHeight;
  // Position top and height attribute for copy and form
  document.getElementById("multiservicecopy").style.height=mainRegionHeight-campusLocHeight + 20;
   if(document.getElementById("multiformImg") != null){
   		document.getElementById("multiformImg").style.height=mainRegionHeight-49;
   	}else if(document.getElementById("multiformImgNoService") != null) {
   		document.getElementById("multiformImgNoService").style.height=mainRegionHeight-49;
   	}
    // Position Right copy spacer
    document.getElementById("rightSpacer1").style.top=headerHeight+14;
    document.getElementById("rightSpacer1").style.height=mainRegionHeight-campusLocHeight+20; 
}
function calculateMultiFormImgBrdrCssPropertiespm() { 
  // Retrieve region div heights
  var headerHeight = document.getElementById("leftwhite_in").offsetHeight;
  var formHeight = document.getElementById("tabid").offsetHeight+headerHeight;
  var copyHeight = document.getElementById("multiformImg2").offsetHeight;
  var pmformbodyHeight = document.getElementById("pmformbody").offsetHeight;
  var mainRegionHeight;

  	if(pmformbodyHeight>formHeight){
	document.getElementById("multiformImg2").style.height=pmformbodyHeight+40+"px";
	document.getElementById("leftwhite").style.height=pmformbodyHeight-5+"px";
	document.getElementById("multiservicecopy").style.height=pmformbodyHeight+50+"px";
	document.getElementById("pmfoot").style.top=pmformbodyHeight+130+"px";	
	}else{
	 mainRegionHeight = formHeight > headerHeight ? formHeight : headerHeight;
	document.getElementById("leftwhite").style.height=mainRegionHeight+80 + "px";
	document.getElementById("multiformImg2").style.height=mainRegionHeight+125 + "px";
	document.getElementById("tabid").style.height=mainRegionHeight;
	document.getElementById("multiservicecopy").style.height=mainRegionHeight+130+"px";
	document.getElementById("pmfoot").style.top=mainRegionHeight+140+"px";
	}  
}
function calculateIndexImgBrdrCssProperties() { 
  // Retrieve region div heights	

    if(document.getElementById("header")!=null)
	  var headerHeight = document.getElementById("header").offsetHeight;
    if(document.getElementById("formImg")!=null)
	  var formHeight = document.getElementById("formImg").offsetHeight+70;

  var campusLocHeight = 0;
  var mainRegionHeight = 0;
  if(document.getElementById("copy")!=null){
	  var copyHeight = document.getElementById("copy").offsetHeight + campusLocHeight;
	if(navigator.userAgent.indexOf('MSIE')>=0 )	
	{

	  if(!isNaN(formHeight)){
	   mainRegionHeight = copyHeight > formHeight ? copyHeight : formHeight; 
	   }
	 }else
	 {
	   mainRegionHeight = copyHeight > formHeight ? copyHeight : formHeight; 
	 }  
   }	  

  // Position top and height attribute for copy and form
 if(document.getElementById("copy")!=null ){
	  document.getElementById("copy").style.height=mainRegionHeight-campusLocHeight + 12;
}
 if(document.getElementById("formImg")!=null ){
	  document.getElementById("formImg").style.height=mainRegionHeight-70;  
	 } 
   // Position Right copy spacer
 if(document.getElementById("rightSpacer")!=null ){     
	  document.getElementById("rightSpacer").style.top=headerHeight+14;
	  document.getElementById("rightSpacer").style.height=mainRegionHeight-campusLocHeight+12;  
  }

}
//Room Addition Service specific function
function calculateIndexImgBrdrCssAdditionalQuestionProperties() { 	
  //Extra question for interior radio button.
  if(document.getElementById("optinquest1")!=null){
  	document.getElementById("optinquest1").style.top=document.getElementById("interior").offsetHeight+10;
  	document.getElementById("optinquest1").style.height=document.getElementById("optinquest11").offsetHeight+document.getElementById("optinquest12").offsetHeight;
  	document.getElementById("exterior").style.top=document.getElementById("interior").offsetHeight+document.getElementById("optinquest1").offsetHeight+10;
  }	  
  //Extra question for exterior radio button.
  if(document.getElementById("optinquest2")!=null){
  	document.getElementById("optinquest2").style.top=document.getElementById("interior").offsetHeight+document.getElementById("optinquest1").offsetHeight+document.getElementById("exterior").offsetHeight+10;
  	document.getElementById("optinquest2").style.height=document.getElementById("optinquest21").offsetHeight+document.getElementById("optinquest22").offsetHeight;
  }	
  var temp=	document.getElementById("interior").offsetHeight+document.getElementById("optinquest1").offsetHeight+document.getElementById("exterior").offsetHeight+document.getElementById("optinquest2").offsetHeight+100;  
  // Position top and height attribute for copy and form
  if(document.getElementById("formImg")!=null && document.getElementById("copy")!=null && document.getElementById("rightSpacer")!=null){
  document.getElementById("formImg").style.height=temp +94;
  document.getElementById("copy").style.height=temp + 176;  
  
   // Position Right copy spacer
  document.getElementById("rightSpacer").style.height=temp+176;
  } 
}
//House Painting service specific function
function calculateIndexImgBrdrCssAdditionalQuestionPropertiesPainting() { 

  //Extra question for interior radio button.
  if(document.getElementById("optinquest1")!=null){
  	document.getElementById("optinquest1").style.top=document.getElementById("interior").offsetHeight+10;
  	document.getElementById("optinquest1").style.height=document.getElementById("optinquest11").offsetHeight+document.getElementById("optinquest12").offsetHeight;
  	document.getElementById("exterior").style.top=document.getElementById("interior").offsetHeight+document.getElementById("optinquest1").offsetHeight+10;
  	document.getElementById("submitBtn").style.top=document.getElementById("exterior").offsetHeight + document.getElementById("interior").offsetHeight+document.getElementById("optinquest1").offsetHeight+10;  	
  	//New
  	//End new
  }
  //Extra question for exterior radio button.
  if(document.getElementById("optinquest2")!=null){
  	document.getElementById("optinquest2").style.top=document.getElementById("exterior").offsetHeight+document.getElementById("optinquest1").offsetHeight+document.getElementById("exterior").offsetHeight+10;
  	document.getElementById("optinquest2").style.height=document.getElementById("optinquest21").offsetHeight+document.getElementById("optinquest22").offsetHeight;  	
  }	
  var temp=	document.getElementById("interior").offsetHeight+document.getElementById("optinquest1").offsetHeight+document.getElementById("exterior").offsetHeight+document.getElementById("optinquest2").offsetHeight+document.getElementById("optinquest23").offsetHeight+document.getElementById("optinquest24").offsetHeight;
  if(document.getElementById("optinquest25") != null) {
  	temp = temp + document.getElementById("optinquest25").offsetHeight;
  }
  temp=temp+80;
  // Position top and height attribute for copy and form
  if(document.getElementById("formImg") != null){
  		document.getElementById("formImg").style.height=temp +94;
  		document.getElementById("copy").style.height=temp + 176;
  }
  
  
   // Position Right copy spacer
   if(document.getElementById("rightSpacer")!= null){
	document.getElementById("rightSpacer").style.height=temp+176;
	}
}

//Added for additional questions asked for Exterior Services
var copyOriginalHeight;
function calculateIndexImgBrdrCssExteriorQuestionProperties(){

	var headerHeight = document.getElementById("header").offsetHeight;	
	var formHeight = null;
	if(document.getElementById("formContent_addquest") != null){
		formHeight = document.getElementById("formContent_addquest").offsetHeight+70;		
	}else{
		formHeight = document.getElementById("formImg").offsetHeight+70;
	}
	var copyHeight = document.getElementById("copy").offsetHeight;
	if(copyOriginalHeight == null)
		copyOriginalHeight = copyHeight;		
	copyHeight = copyOriginalHeight;
	var mainRegionHeight = copyHeight > formHeight ? copyHeight : formHeight;		
	// Position top and height attribute for copy and form
	document.getElementById("copy").style.height=mainRegionHeight+ 12;
	document.getElementById("formImg").style.height=mainRegionHeight - 70;		
	// Position Right copy spacer
	document.getElementById("rightSpacer").style.top=headerHeight+14;
	document.getElementById("rightSpacer").style.height=mainRegionHeight+12;
}
function calculateNonFormCssProperties() {
 	var headerHeight = document.getElementById("header").offsetHeight;
	var copyHeight = document.getElementById("nonFormCopy").offsetHeight;
	document.getElementById("nonFormCopy").style.top=headerHeight; 
} 
function calculatePopPrgCssProperties() { 
    var maximumHeight = calculateHeight();
    leftHeight = document.getElementById("popupLeftCopy").offsetHeight;
    rightHeight = document.getElementById("popupMainCopy").offsetHeight;
    if ( maximumHeight > leftHeight && maximumHeight > rightHeight ) {
        document.getElementById("popupLeftCopy").style.height=maximumHeight;
        document.getElementById("popupMainCopy").style.height=maximumHeight;
        document.getElementById("popupFooter").style.top=maximumHeight+127;
    } else if(leftHeight < rightHeight) {
        document.getElementById("popupLeftCopy").style.height=document.getElementById("popupMainCopy").offsetHeight;
        document.getElementById("popupFooter").style.top=document.getElementById("popupMainCopy").offsetHeight+127;        
    } else {
        document.getElementById("popupMainCopy").style.height=document.getElementById("popupLeftCopy").offsetHeight;
        document.getElementById("popupFooter").style.top=document.getElementById("popupLeftCopy").offsetHeight+127;        
    }
    document.getElementById("popUpRightSpacer").style.height=document.getElementById("popupMainCopy").offsetHeight;
} 
function openWin(page,win_width,win_height) {
    try {
    	popup_window.close();
    } catch(e) {}
    if ( page.indexOf("mailto") == -1 ) {
    	var options = "scrollbars=yes, width=" + win_width + ", height=" + win_height;
    	var win = window.open(page, 'MyWin', options);
    	if (window.focus) { win.focus() }
    }
}
function showLayer( layerToShow ) {           
	var layerValue = layerToShow;
    var idArray = layerArray();
	for ( var i=0; i<idArray.length; i++ ) {
		var idTmp = idArray[i];
        if ( layerValue == idTmp ) {
			document.getElementById( idTmp ).style.visibility='visible';
       }else{
			document.getElementById( idTmp ).style.visibility='hidden';
		}
	}
}
function calculateHeight() {
	var maxHeight = 0;
	var idArray_ = layerArray();
	for ( var i=0; i<idArray_.length; i++ ) {
		var divId = idArray_[i];
        var divIdHeight = document.getElementById( divId ).offsetHeight;
		if ( divIdHeight > maxHeight ) {
			maxHeight = divIdHeight + 20;
        }
	}
    return maxHeight;              
}
function doProcessingIndex() {
  document.getElementById('submitBtn').className = 'thide'; 	
  document.getElementById('processing').className = 'tshow';
  calculateIndexImgBrdrCssProperties();
}
function doProcessingMultiForm() {
  document.getElementById('submitBtn').className = 'thide'; 	
  document.getElementById('processing').className = 'tshow';
  calculateMultiFormImgBrdrCssProperties();
}
function doProcessingMultiFormpm() {
  document.getElementById('submitBtn').className = 'thide'; 	
  document.getElementById('processing').className = 'tshow';
}

function doProcessing() {
  document.getElementById('submitBtn').className = 'thide'; 	
  document.getElementById('processing').className = 'tshow';  
}
function doSplashProcessing() {
  document.getElementById('submitBtn').className = 'thide'; 	
  document.getElementById('splashprocessing').className = 'tshow'; 
}
function doProcessingForm() {
  document.getElementById('submitBtn').className = 'thide'; 	
  document.getElementById('processing').className = 'tshow';
  MctoggleProperties();
}

function doProcessingUserForm() {
  document.getElementById('submitBtn').className = 'thide'; 	
  document.getElementById('processing').className = 'tshow';
  calculateFormImgBrdrCssProperties();
}
function MctoggleProperties() 
{
	// Retrieve region div heights
  var headerHeight = document.getElementById("header").offsetHeight;
  var formHeight = document.getElementById("formImg").offsetHeight+70;
  var campusLocHeight = 0;
  var copyHeight = document.getElementById("copyContent").offsetHeight;
  var mainRegionHeight = copyHeight > formHeight ? copyHeight : formHeight;
  // Position top and height attribute for copy and form
  document.getElementById("copy").style.height=mainRegionHeight-campusLocHeight + 12;
  document.getElementById("formImg").style.height=mainRegionHeight-70;
   // Position Right copy spacer
  document.getElementById("rightSpacer").style.top=headerHeight+14;
  document.getElementById("rightSpacer").style.height=mainRegionHeight-campusLocHeight+12; 
}
function calculateFormImgBrdrMctoggleProperties(){ 
	displayinfo(vendorcount,'no');
	MctoggleProperties() ;
}
function displayContent(counters){
	displayinfo(counters,'yes');
	MctoggleProperties() ;
}
function openPopupWindow(page){
    try {
    	popup_window.close();
    } catch(e){}
   var win_width = '517px';
   var win_height = '460px';
   if (page=='popups/options.jsp'){
   	win_width = '630px';
	win_height = '700px';
   }
    if ( page.indexOf("mailto") == -1 ){
    	var options = "scrollbars=yes, width=" + win_width + ", height=" + win_height;
    	var win = window.open(page, 'MyWin', options);
    	if (window.focus) { win.focus() }
    }
}
// Purpose: Open footer urls in separate window
function openNewUrlWindow(url) {	// scroll needs to be a 1 or 0
	width = 450;
	height = 445;
	bName = navigator.appName;
	bVer = parseInt(navigator.appVersion);
	if((bName == "Netscape" && bVer >= 3) || (bName == "Microsoft Internet Explorer" && bVer >= 4))
		br = "n3";
	else
		br = "n2";		
	if(br == "n3"){
		prop = 'toolbar=no,width=' + width + ',height=' + height + ',left=430,top=200,directories=0,status=0,scrollbars=' + scroll + ',resizable=yes,menubar=0,location=0,copyhistory=0';
		newWindow=window.open(url, 'lilone', prop);
	}
}

	function removePadding()
		{
			
			var abc = document.getElementById('submitnothingstr').childNodes;
			
			if(navigator.userAgent.indexOf('MSIE')>=0 )	
			{
			 abc[0].id = 'submitnothingstrchild' ;
			}else{
			 abc[1].id = 'submitnothingstrchild';
			}
			
			
		
		}
    

		
//Display mouse over copy on index page
var tipwidth='150px' //default tooltip width
var tipbgcolor='lightyellow'  //tooltip bgcolor
var disappeardelay=10  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="0px" //vertical offset of tooltip from anchor link
var horizontal_offset="0px" //horizontal offset of tooltip from anchor link

// No further editing needed
var ie4=document.all
var ns6=document.getElementById&&!document.all
if (ie4||ns6)
document.write('<div id="fixedtipdiv" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>');