
//include search code
document.write('<script type="text/javascript" language="JavaScript" src="/common/jsBrowserStuff.php"></script>');
document.write('<script type="text/javascript" language="JavaScript" src="/common/rchCommon.js?t=20091002"></script>');

//jQuery code for datepicker
document.write('<script type="text/javascript" src="/common/jQuery/js/jquery-1.3.2.min.js"></script>');
document.write('<script type="text/javascript" src="/common/jQuery/js/jquery-ui-1.7.2.custom.min.js"></script>');
	
var imgButtonBG=new Image();
imgButtonBG.src='/images/btnBG-01.gif';

var imgButtonBGon=new Image();
imgButtonBGon.src='/images/btnBGon-01.gif';

var imgTBBGDft=new Image();
imgTBBGDft.src='/images/TransBit2.gif';

var imgTBBGEmail=new Image();
imgTBBGEmail.src='/images/tbBG-Email-01.gif';

var imgBtnBGMain=new Image();
imgBtnBGMain.src='/images/btnBGMain-01.gif';

var imgBtnBGOver=new Image();
imgBtnBGOver.src='/images/btnBGMainOver-01.gif';

var timGHideMenus;

var timMidNav;
var gMidNavHeight=5;
var curMidNavWin;

var ajax = new sack();
var timNews;
var gInRefresh=false;

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ gInitPage()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function gInitPage(){
	
	//global onload function
	//load weather via ajax
	//window.alert('global load');
	
	curZip=getCookie('waDftZip');
	if (!curZip){
		//no default set
		curZip='14602';
	}
	//document.getElementById('tdHeadWeather').innerHTML=curZip;
	
	ajax.requestFile = '/common/ajax/_LoadWeather.php?z='+curZip;
	//ajax.requestFile = 'http://beta.waachaa.com/common/ajax/_LoadWeather.php?z='+curZip;
	ajax.onCompletion = showWeather;	
	ajax.runAJAX();		
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ showWeather()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function showWeather(){
	
	var result=ajax.response;
	document.getElementById('tdHeadWeather').innerHTML=result;
	//window.alert(result);
	
	gInRefresh=false;
	//window.alert('weather OK');
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ submitGlobalSearch(){
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function submitGlobalSearch(){
	
	tmpObj=document.getElementById('txtHeadSearchStr');
	if (tmpObj.value==''){
		window.alert('Please enter your search phrase.');
	}else{
		top.location='/search.php?k='+tmpObj.value;
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ hlButton()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hlButton(inObj, inMode){
	if (inMode=='over'){
		inObj.className='frmButtonOn';
	}else{
		inObj.className='frmButton';
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ hoverButton()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hoverButton(inObj, inMode){
	
	if (inMode=='over'){
		inObj.style.backgroundImage='url(/images/btnBGMainOver-01.gif)';
	}else{
		inObj.style.backgroundImage='url(/images/btnBGMain-02.gif)';
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ hlMenuLink()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hlMenuLink(inObj, inMode){
	if (inMode=='over'){
		inObj.className='menuLinkOver';
	}else{
		inObj.className='menuLink';
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ valHeadLogin()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function valHeadLogin(){
	
	objForm=document.getElementById('frmHeadLogin');
	objForm.action='/cpanel/valLogin.php';
	objForm.submit();
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ checkTBState()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function checkTBState(inObj, inMode, inTB){
	
	if (inMode=='on'){
		inObj.className='headLoginTBDft';
		
	}else{
		if (inObj.value==''){
			inObj.className='headLoginTB'+inTB;
		}else{
			inObj.className='headLoginTBDft';
		}
		
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ showSubMenu()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function showSubMenu(inMenu, inBaseObj){
	
	clearTimeout(timGHideMenus);
	
	objMenu=document.getElementById('divSubMenu'+inMenu);
	
	objMenu.style.left=parseInt(findPosX(inBaseObj))-1+'px';
	objMenu.style.top=parseInt(findPosY(inBaseObj))+34+'px';
	
	objMenu.style.display='block';
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ hideSubMenu()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hideSubMenu(inMenu){
	
	//timGHideMenus=setTimeout('finHideSubMenu(\''+inMenu+'\')', 200);
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ finHideSubMenu()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function finHideSubMenu(inMenu){
	
	objMenu=document.getElementById('divSubMenu'+inMenu);
	objMenu.style.display='none';
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ setInMenu()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function setInMenu(){
	//used to clear timer when on menu
	
	clearTimeout(timGHideMenus);
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ getElementLeft()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function getElementLeft(Elem){
	if (gJSBrowserType=='ns4'){
		var elem = getObjNN4(document, Elem);
		return elem.pageX;
	}else{
		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		}else if (document.all){
			var elem = document.all[Elem];
		}
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
		}
		return xPos;
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ getElementTop()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function getElementTop(Elem){
	if (gJSBrowserType=='ns4'){
		var elem = getObjNN4(document, Elem);
		return elem.pageY;
	}else{
		if(document.getElementById){	
			var elem = document.getElementById(Elem);
		}else if (document.all){
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null){
			yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ getElementHeight()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function getElementHeight(Elem){
	if (gJSBrowserType=='ns4'){
		var elem = getObjNN4(document, Elem);
		return elem.clip.height;
	}else{
		if(document.getElementById){
			var elem = document.getElementById(Elem);
		}else if (document.all){
			var elem = document.all[Elem];
		}
		if (gJSBrowserType=='op5'){ 
			xPos = elem.style.pixelHeight;
		}else{
			xPos = elem.offsetHeight;
		}
		return xPos;
	} 
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ getElementWidth()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function getElementWidth(Elem) {
	if (gJSBrowserType=='ns4'){
		var elem = getObjNN4(document, Elem);
		return elem.clip.width;
	}else{
		if(document.getElementById){
			var elem = document.getElementById(Elem);
		}else if (document.all){
			var elem = document.all[Elem];
		}
		if (gJSBrowserType=='op5'){
			xPos = elem.style.pixelWidth;
		}else{
			xPos = elem.offsetWidth;
		}
		return xPos;
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ formatZipCode()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function formatZipCode(inObj){
	
	newVal=inObj.value;
	
	newVal=newVal.replace(/[^0-9, -]/g, ''); 
	
	inObj.value=newVal;
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ startGetHelp()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function startGetHelp(){
	
	document.getElementById('trGetHelpStart').style.display='none';
	document.getElementById('trGetHelpFin').style.display='none';
	document.getElementById('trGetHelpDisp').style.display=gCSSDisplayTableRow;
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ expandCenterNav()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function expandCenterNav(inMode){
	
	curMidNavWin=inMode;
	
	//hide all to start
	document.getElementById('divNavMidLogin').style.height='0px';
	document.getElementById('divNavMidZip').style.height='0px';
	
	gMidNavHeight=0;
	
	timMidNav=setTimeout('expandMidNav()', 7);
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ expandMidNav()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function expandMidNav(){
	
	objNav=document.getElementById('divNavMid'+curMidNavWin);
	gMidNavHeight++;
	objNav.style.height=gMidNavHeight+'px';
	
	if (parseInt(gMidNavHeight)<35){
		timMidNav=setTimeout('expandMidNav()', 7);
	}else{
		setFocus(curMidNavWin);
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ setFocus()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function setFocus(inMode){
	
	switch (inMode){
	case 'Login':
		document.getElementById('txtLoginName').focus();
		document.getElementById('txtLoginName').select();
		break;
	case 'Zip':
		document.getElementById('txtNewDftZip').focus();
		document.getElementById('txtNewDftZip').select();
		break;
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ checkHeadTBKey()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function checkHeadTBKey(inObj, inDftVal, inMode){
	
	//window.alert(inObj.style.backgroundImage);
	
	if (inMode=='blur'){
		if (inObj.value==''){
			inObj.style.backgroundImage='url(/images/tbBG-'+inDftVal+'-02.gif)';
		}else{
			inObj.style.backgroundImage='url(/images/TransBit.gif)';
		}
	}else{
		//focus, hide
		inObj.style.backgroundImage='url(/images/TransBit.gif)';
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ trackSPPCClick()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function trackSPPCClick(inSPPCKey, inMode, inSearch){
	
	top.location='/followSPPC.php?k='+inSPPCKey+'&m='+inMode+'&s='+inSearch;
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ reportError()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function reportError(inListingKey){
	
	if (reportError.arguments[1]){
		//called from an offer
		top.location='/help/reportProfileError.php?k='+inListingKey+'&offer='+reportError.arguments[1];
	}else{
		//called from standard listing
		top.location='/help/reportProfileError.php?k='+inListingKey;
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ submitHelpMsg()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function submitHelpMsg(inUser){
	
	if (gInRefresh==true){
		timNews=setTimeout('submitHelpMsg(\''+inUser+'\')', 1000);
	}
	gInRefresh=true;
	
	tmpMsg=document.getElementById('txtGetHelp').value;
	
	ajax.requestFile = '/common/ajax/_SaveHelpRequest.php?u='+inUser+'&m='+tmpMsg;
	ajax.onCompletion = finSubmitHelpMsg;	
	ajax.runAJAX();		
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ finSubmitHelpMsg()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function finSubmitHelpMsg(){
	
	var result=ajax.response;
	//window.alert(result);
	gInRefresh=false;
	
	document.getElementById('trGetHelpDisp').style.display='none';
	document.getElementById('trGetHelpStart').style.display=gCSSDisplayTableRow;
	document.getElementById('trGetHelpFin').style.display=gCSSDisplayTableRow;
	
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++
//++
//++ code to hight light the login boxes bg
//++
//++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var gLoginHL=0;
var timLogin;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ hlLogin()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function hlLogin(){
	
	expandCenterNav('Login');
	
//	gLoginHL=0;
	
//	window.scroll(0, 0);
//	timLogin=setTimeout('blinkLoginHL()', 300);
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ blinkLoginHL()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function blinkLoginHL(){
	
	loginObj=document.getElementById('tblHeadLogin');
	
	if ((gLoginHL % 2)==1){
		loginObj.style.backgroundColor='#ffffff';
	}else{
		loginObj.style.backgroundColor='#1caaec';
	}
	
	gLoginHL++;
	
	if (gLoginHL<=5){
		timLogin=setTimeout('blinkLoginHL()', 300);
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ checkLoginKeys()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function checkLoginKeys(inObj, inEvent){
	
	if (inEvent.keyCode==13){
		valHeadLogin();
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ checkNewZipKeys()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function checkNewZipKeys(inObj, inEvent){
	
	if (inEvent.keyCode==13){
		setNewDftZip();
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ setNewDftZip()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function setNewDftZip(){
	
	tmpObj=document.getElementById('txtNewDftZip');
	
	top.location='/setDftZip.php?z='+tmpObj.value;
	
}	
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ findPosX()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function findPosX(inObj){
	var curLeft = 0;
  
  if(inObj.offsetParent){
   	while(1){
   		curLeft += inObj.offsetLeft;
      if(!inObj.offsetParent){
      	break;
      }
      inObj = inObj.offsetParent;
    }
  }else if(inObj.x){
  	curLeft += inObj.x;
  }
  
  return curLeft;
  
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ findPosY()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function findPosY(inObj){
	var curTop = 0;
	
	if(inObj.offsetParent){
		while(1){
			curTop += inObj.offsetTop;
      if(!inObj.offsetParent){
      	break;
      }
      inObj = inObj.offsetParent;
    }
  }else if(inObj.y){
  	curTop += inObj.y;
  }
  
  return curTop;
  
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ findPosW()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function findPosW(inObj){
	
	if (gJSBrowserType=='op5'){
		xPos = inObj.style.pixelWidth;
	}else{
		xPos = inObj.offsetWidth;
	}
	
	xPos = inObj.offsetWidth;
	
	return xPos;
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ findPosH()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function findPosH(inObj){
	
	if (gJSBrowserType=='op5'){ 
		xPos = inObj.style.pixelHeight;
	}else{
		xPos = inObj.offsetHeight;
	}
	
	return xPos;
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ saveWinHeight
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function saveWinHeight(){
	
//	if (gJSBrowserType=='ie'){
//		//curHeight=document.body.offsetHeight;
//		//curHeight=document.body.clientHeight;
//		
//	}else{
//		curHeight=window.innerHeight;
//	}
	
	if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
	curHeight=myHeight;
	
	jsSetCookie('waWH', curHeight, 360);
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ jsSetCookie()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function jsSetCookie(inCookieName,inCookieValue,inDays){
	var today = new Date();
 	var expire = new Date();
 	
 	if (inDays==null || inDays==0) inDays=1;
 	
 	expire.setTime(today.getTime() + 3600000*24*inDays);
 	document.cookie = inCookieName+"="+escape(inCookieValue)+";expires="+expire.toGMTString();
 	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ addToOnload()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function addToOnload(inFuncName){
	//remember to call this after any third party apps have been called
	//ie after the header
	//sample: <script>addToOnload('initPage()');</script>
	
	//window.alert(inFuncName);
	
	var nowOnload = window.onload; // Let's save the existing assignment, if any
	window.onload = function () {
		// Here is your precious function
		// You can call as many functions as you want here;
		
		setTimeout(inFuncName, 0); //myOnloadFunction1();
		
		// Now we call old function which was assigned to onLoad, thus playing nice
		if(nowOnload != null && typeof(nowOnload) == 'function') {
			nowOnload();
		}
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ getCookie()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function getCookie(c_name){
	
	if (document.cookie.length>0){
		//window.alert(document.cookie);
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	
	return '';
	
}