

// Utility Javascript for jobshark	

function imgRef(myLayer,myImage) { // creating a generic object reference
	if(document.layers) { //ns4
		obj = eval("document.layers['" + myLayer + "'].document.images['" + myImage + "']");
	}
	else if(document.all){ //MSIE
		obj = eval("document.all('" + myImage + "')");
	}
	else if(document.getElementById){//ns6+Mozilla
		obj = eval("document.getElementById('"+myImage+"')");
	}
	
	return obj;
}
				




	// rollover preloads
	//	  format of image object is "image name" + "_on" or "_off" ; 
	//	  on image file has "_h", off image file doesn't


 function loadImages() {
		if(document.images) {
			debug = "";
			var state = new Array("","_off","_on");
			var suffix = new Array("","","_h");
			for(var i=1;i<=33;i++) {
				for(var j=1;j<3;j++) {// nav images by number
		eval('b'+ i + state[j] + '= new Image()');
		eval('b'+ i + state[j] + '.src = \"/img/nav_' + i + suffix[j] + '.gif\"');
					}
				}
			}
			
			resizetipsheight();
		}
		
loadImages();


// rollover code uses imgRef above
function RollOn(myLayer,myImage) {

	eval("imgRef(myLayer,myImage).src = " + myImage + "_on.src");
}

function RollOff(myLayer,myImage) {
	eval("imgRef(myLayer,myImage).src = " + myImage + "_off.src");
}

function NewWindow(jobshark, popwin, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
win = window.open(jobshark, popwin, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function getHight() {
	alert (companyprofiles.clientHeight);

	return companyprofiles.clientHeigh;
}

function setTipH(divname,moreval) {

dname = divname;
v = moreval;


if(window.document.tips)
{
window.document.tips.clip.height = eval("window.document." + dname + ".clip.height" ) - 25;
}
else
{
alert(dname);
alert(eval(dname + ".clientHeight"));
tiptable.height = eval(dname + ".clientHeight") - 20 - v;
}
}


var vHeight;

function getMainHeight(divName) 
{	//alert (companyprofiles.clientHeight);
	//return companyprofiles.clientHeigh;
	
	var obj;
	if (document.layers)
	{
		obj = eval("document." + divName);
		vHeight = obj.clip.height - 25;
		return vHeight;
	}
	//no layer
	else
	{
		obj = eval(divName);
		vHeight = obj.clientHeight - 50;
		return vHeight;
	
	}

}

function ResizeTips(divName,tipName,imgspacer)
{	
	var obj;
	var imgheight;
	var test;
	
	if(document.layers)
	{
		obj = eval("document." + tipName);
		myImage = new Image(1, getMainHeight(divName));
		eval('myImage.src = \"/img/spacer.gif\"');
		obj.clip.height = getMainHeight(divName);
		eval('document.' + tipName + '.background.src = \"/img/grey_grad.gif\"');
		obj.document.images['imgs'].src = myImage.src;
		
	}
	
	//no layer
	else
	{
		obj = eval(tipName);
		obj.height = getMainHeight(divName);
		tiptable.height = getMainHeight(divName);
		
		//alert(tiptable.height); alert(tiptable.height); alert(tiptable.height);
		//obj.clientHeight = getMainHeight(divName);
		//alert(getMainHeight(divName));
		//alert(obj.clientHeight + " main2 " + getMainHeight(divName));
	
	}

}


/////////////

function resizetipsheight()
{	
	var obj;
	var orgheight;
	var totalheight;
	
if (parent.frames[1])
 {
	  
if (parent.frames[1].document.layers)
	{
		if (eval(parent.frames[1].document.layers['jobsearch']) && eval(parent.frames[1].document.layers['tips']))
		{	
			orgheight = document.tips.clip.height;
			if (orgheight < getMainHeight('jobsearch'))
			{
				//if (getMainHeight('jobsearch')>= 800)//
				//{//
					document.tips.clip.height = getMainHeight('jobsearch') - 60;
					
				//}//
				//else//
				//{//
					//document.tips.clip.height = 800;//
					//document.jobsearch.clip.height = 800;
				//}//
			}
			//else//
			//{//
				//if (orgheight < 800)//
				//{//
					//document.tips.clip.height = 800;//
				//}//
			
			//}//
			//alert(document.tips.clip.height);
			eval('document.tips.background.src = \"/img/grey_grad.gif\"');
			
			//alert("old" + orgheight + "new " + document.tips.clip.height);
		}
		
		if (eval(parent.frames[1].document.layers['companyprofiles']) && eval(parent.frames[1].document.layers['tips']))
		{	
			orgheight = document.tips.clip.height;
			if (orgheight < getMainHeight('companyprofiles'))
			{
				document.tips.clip.height = getMainHeight('companyprofiles');
			}
			document.tips.clip.height = getMainHeight('companyprofiles') - 60;
			eval('document.tips.background.src = \"/img/grey_grad.gif\"');
		
		}
		
		if (eval(parent.frames[1].document.layers['account']) && eval(parent.frames[1].document.layers['jobs']) && eval(parent.frames[1].document.layers['applications']) && eval(parent.frames[1].document.layers['tips']))
		{	
			
			orgheight = document.tips.clip.height;
			//totalheight = getMainHeight('account') + getMainHeight('jobs') + getMainHeight('applications');
			totalheight = document.account.clip.height + document.jobs.clip.height + document.applications.clip.height - 25 - 60;
			if (orgheight < totalheight)
			{
				document.tips.clip.height = totalheight;
			}
			eval('document.tips.background.src = \"/img/grey_grad.gif\"');
			//alert(getMainHeight('account') + " se " + getMainHeight('jobs') + "th " + getMainHeight('applications'));
			//alert(orgheight + "new " + totalheight);
		}
	
	}
	//no layer
	else
	{
		if (eval("document.all('jobsearch')") && eval("document.all('tips')"))
		{	
			//orgheight = document.all('tips').style.height;
			//if (orgheight < getMainHeight('jobsearch'))
			//{
			//	document.all('tips').style.height = getMainHeight('jobsearch');
			//}
			obj = eval('tips');
			obj.height = getMainHeight('jobsearch');
			//alert(tiptable.height);
			tiptable.height = getMainHeight('jobsearch') - 60;
			//alert(tiptable.height);
			
		}
		
		if (eval("document.all('companyprofiles')") && eval("document.all('tips')"))
		{	//alert("ok");
			//orgheight = document.all('tips').style.height;
			//if (orgheight < getMainHeight('companyprofiles'))
			//{
			//	document.all('tips').style.height = getMainHeight('companyprofiles');
			//}
			
			//eval('document.all("tips").style.backgroundImage = \"/img/grey_grad.gif\"');
			//alert(document.all("tips").style.backgroundImage);
			//alert("old" + orgheight + "new " + document.all('tips').style.height);
			obj = eval('tips');
			obj.height = getMainHeight('companyprofiles');
			//alert(tiptable.height);
			tiptable.height = getMainHeight('companyprofiles') - 60;
			//alert(tiptable.height);
		}
		
		
		//if (eval("document.all('account')") && eval("document.all('jobs')") && eval("document.all('applications')") && eval("document.all('tips')"))
		//{	
			
			//orgheight = document.all('tips').style.height;
			
			// totalheight = getMainHeight('account')* 2 + getMainHeight('jobs') + getMainHeight('applications');
			//totalheight = document.all("account").clientHeight + document.all("jobs").clientHeight + document.all("applications").clientHeight - 50;
			
			//if (orgheight < totalheight)
			//{
			//	document.all('tips').style.height = totalheight;
			//}
			//eval('document.tips.background.src = \"/img/grey_grad.gif\"');
			//alert(getMainHeight('account') + " se " + getMainHeight('jobs') + "th " + getMainHeight('applications'));
			//alert(orgheight + "new " + totalheight + "tips " + document.all('tips').style.height);
		
			//obj = eval('tips');
			//obj.height = totalheight;
			//alert(tiptable.height);
			//tiptable.height = totalheight;
		
		//}
		
		if (eval(document.all['account']) && eval(document.all['jobs']) && eval(document.all['applications']) && eval(document.all['tips']))
		{	
			obj = eval('tips');
			totalheight = parseInt(getMainHeight('jobs')) + parseInt(getMainHeight('applications')) + 150;
			
			obj.height = totalheight;
			tiptable.height = totalheight - 60;

				
			
		}
	
	}	  
	  
 }
else	
 {	
	if (parent.document.layers)
	{
		if (eval(parent.document.layers['jobsearch']) && eval(parent.document.layers['tips']))
		{	
			orgheight = document.tips.clip.height;
			if (orgheight < getMainHeight('jobsearch'))
			{
				//if (getMainHeight('jobsearch')>= 800)//
				//{//
					document.tips.clip.height = getMainHeight('jobsearch') - 60;
					
				//}//
				//else//
				//{//
					//document.tips.clip.height = 800;//
					//document.jobsearch.clip.height = 800;
				//}//
			}
			//else//
			//{//
				//if (orgheight < 800)//
				//{//
					//document.tips.clip.height = 800;//
				//}//
			
			//}//
			//alert(document.tips.clip.height);
			eval('document.tips.background.src = \"/img/grey_grad.gif\"');
			
			//alert("old" + orgheight + "new " + document.tips.clip.height);
		}
		
		if (eval(parent.document.layers['companyprofiles']) && eval(parent.document.layers['tips']))
		{	
			orgheight = document.tips.clip.height;
			if (orgheight < getMainHeight('companyprofiles'))
			{
				document.tips.clip.height = getMainHeight('companyprofiles');
			}
			document.tips.clip.height = getMainHeight('companyprofiles') - 60;
			eval('document.tips.background.src = \"/img/grey_grad.gif\"');
		
		}
		
		if (eval(parent.document.layers['account']) && eval(parent.document.layers['jobs']) && eval(parent.document.layers['applications']) && eval(parent.document.layers['tips']))
		{	
			
			orgheight = document.tips.clip.height;
			//totalheight = getMainHeight('account') + getMainHeight('jobs') + getMainHeight('applications');
			totalheight = document.account.clip.height + document.jobs.clip.height + document.applications.clip.height - 25 - 60;
			if (orgheight < totalheight)
			{
				document.tips.clip.height = totalheight;
			}
			eval('document.tips.background.src = \"/img/grey_grad.gif\"');
			//alert(getMainHeight('account') + " se " + getMainHeight('jobs') + "th " + getMainHeight('applications'));
			//alert(orgheight + "new " + totalheight);
		}
	
	}
	//no layer
	else
	{
		if (eval("document.all('jobsearch')") && eval("document.all('tips')"))
		{	
			//orgheight = document.all('tips').style.height;
			//if (orgheight < getMainHeight('jobsearch'))
			//{
			//	document.all('tips').style.height = getMainHeight('jobsearch');
			//}
			obj = eval('tips');
			obj.height = getMainHeight('jobsearch');
			//alert(tiptable.height);
			tiptable.height = getMainHeight('jobsearch') - 60;
			//alert(tiptable.height);
			
		}
		
		if (eval("document.all('companyprofiles')") && eval("document.all('tips')"))
		{	//alert("ok");
			//orgheight = document.all('tips').style.height;
			//if (orgheight < getMainHeight('companyprofiles'))
			//{
			//	document.all('tips').style.height = getMainHeight('companyprofiles');
			//}
			
			//eval('document.all("tips").style.backgroundImage = \"/img/grey_grad.gif\"');
			//alert(document.all("tips").style.backgroundImage);
			//alert("old" + orgheight + "new " + document.all('tips').style.height);
			obj = eval('tips');
			obj.height = getMainHeight('companyprofiles');
			//alert(tiptable.height);
			tiptable.height = getMainHeight('companyprofiles') - 60;
			//alert(tiptable.height);
		}
		
		
		//if (eval("document.all('account')") && eval("document.all('jobs')") && eval("document.all('applications')") && eval("document.all('tips')"))
		//{	
			
			//orgheight = document.all('tips').style.height;
			
			// totalheight = getMainHeight('account')* 2 + getMainHeight('jobs') + getMainHeight('applications');
			//totalheight = document.all("account").clientHeight + document.all("jobs").clientHeight + document.all("applications").clientHeight - 50;
			
			//if (orgheight < totalheight)
			//{
			//	document.all('tips').style.height = totalheight;
			//}
			//eval('document.tips.background.src = \"/img/grey_grad.gif\"');
			//alert(getMainHeight('account') + " se " + getMainHeight('jobs') + "th " + getMainHeight('applications'));
			//alert(orgheight + "new " + totalheight + "tips " + document.all('tips').style.height);
		
			//obj = eval('tips');
			//obj.height = totalheight;
			//alert(tiptable.height);
			//tiptable.height = totalheight;
		
		//}
		
		if (eval(document.all['account']) && eval(document.all['jobs']) && eval(document.all['applications']) && eval(document.all['tips']))
		{	
			obj = eval('tips');
			totalheight = parseInt(getMainHeight('jobs')) + parseInt(getMainHeight('applications')) + 150;
			
			obj.height = totalheight;
			tiptable.height = totalheight - 60;

				
			
		}
	
	}

  }
}


