var ace_path = 'menu/tuscan/';

function getSourceFrame()
{
	if (location.search=="")
	{
		document.getElementById('jobs').src = "http://drakenz.turborecruit.com.au";
	}
	else
	{
		var adURL = location.search.substring(5,location.search.length);
		document.getElementById('jobs').src = adURL;
	}	
}

function genEmail(name,host,lable)
{
	if (name=='')
	{
		return;
	}
	else{
		var b=host;
		b=b.replace(/[.]/g,"%2E");
		name+="%40";
		name+=b;
		document.write('<a href="&#x6D;&#x61;&#x69;&#x6C;&#x74;&#x6F;&#x3A;'+name+'">'+lable+'</a>');
	}
}

function showpanel(myObjID){
	if (myObjID == 'candidate')
		document.getElementById('panel').innerHTML = "<div class=\"copy bold tuscan\" style=\"margin:17px 10px 0px 10px;\">Candidate job search</div> <div class=\"copy\" style=\"margin:17px 10px 0px 10px;\">Looking for work?  Get hired.  Drake doesn't find just any job to our candidates - we develop relationships with job seekers to ensure that the right people, with the right skills and behaviour, are put into the right roles.  We want you to Outperform!</div>";
	else if (myObjID == 'jobmail')
		document.getElementById('panel').innerHTML = "<div class=\"copy bold tuscan\" style=\"margin:17px 10px 0px 10px;\">Candidate job mail</div> <div class=\"copy\" style=\"margin:17px 10px 0px 10px;\">Job mail is the email we send to you when we have positions listed that match the criteria you have selected.  Logon required.</div>";
	else
		document.getElementById('panel').innerHTML = "<div class=\"copy bold tuscan\" style=\"margin:17px 10px 0px 10px;\">Employer Resource Centre</div> <div class=\"copy\" style=\"margin:17px 10px 0px 10px;\">We optimise your company's profit by applying a bland of flexible staffing, permanent recruitment and technology solutions.  Drake reduces costs, increases revenue and customises HR solutions including outsourcing of non-core business functions.  Our unique vision hires the right people for our clients the first time, saving them money by reducing their need for recruitment.</div>";			
}	

// PH Stuff
function showCategory(heading, body){
	var src = "<div class=\"ServiceOfferingHeadings\">"+heading+"</div> <div class=\"ServiceOfferingCopyMargins\">"+body+"</div>";
	document.getElementById('panel').innerHTML = src;
}

function showDesc(heading, body, detail){

      var src = "<strong><span class=\"orange_text\">"+heading+"</span>"+body+"</strong>"+detail;

      document.getElementById('bsbox').innerHTML = src;

}

function showPollDesc(rowid)
{
if (rowid=='1')
{
document.getElementById('intro').style.display='inline';
}
}
//end PH Stuff

function underline(myObjID){
	document.getElementById(myObjID).style.textDecoration='underline';
}
		
function restore(myObjID){
	document.getElementById(myObjID).style.textDecoration='none';
}

function changeFont(value){
//	var i = 0;
//	while (document.getElementById('size'+i)!=null){
//		document.getElementById('size'+i).style.fontSize=value;		
//		i++;
//	}	
	
//	createCookie('fontSize',value,1000);	
//	document.getElementById('cboSelectFont').selectedIndex = getSelectedIndex(value);
}

function getSelectedIndex(value){
	if (value=='70%')
		return 0;
	else if (value=='90%')
		return 1;
	else if (value=='110%')
		return 2;
	else if (value=='130%')
		return 3;
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0; i<ca.length; i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return '70%';
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}


function getAreas(){
	 while (document.getElementById("lbArea").options.length!=0){
				document.getElementById("lbArea").options[0]=null;
			} 

}



// used for multiple textboxes
function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

//Contador de caracteres.
function Contar(entrada,salida,texto,caracteres) {
  var entradaObj=getObject(entrada);
  var salidaObj=getObject(salida);
  var longitud=caracteres - entradaObj.value.length;
  if(longitud <= 0) {
    longitud=0;
    texto='<span class="disable"> '+texto+' </span>';
    entradaObj.value=entradaObj.value.substr(0,caracteres);
  }
  salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}
// end of used for multiple textboxes

function ClearTheBox(obj) {
obj.background = Nothing
}

function submitToGoogle(keyword){
	window.location = 'http://www.google.com/search?sitesearch=www.drakeintl.com&domains=www.drakeintl.com&q='+keyword;
}

function onmover(id, classname, hoverclass){
	document.getElementById(id).className = classname + ' ' + hoverclass;
}			
function reverseonmover(id, classname ){	
	document.getElementById(id).className = classname;				
}
function removeImage(){				
	document.getElementById('txtSearch').style.background = "url(../images/spacer.gif)";
}	
function CheckChanged()  
{                          
	var frm = document.Form1;  
	var boolAllChecked;           
	boolAllChecked=true;         
	for(i=0;i< frm.length;i++) 
	{                             
		e=frm.elements[i];		
		if ( e.type=='checkbox' && e.name.indexOf('lblDbId') != -1 )
			if(e.checked== false)                    
			{                                       
				boolAllChecked=false;                
				break;                               
			}                                       
	}                                           
	for(i=0;i< frm.length;i++)                  
	{                                           
		e=frm.elements[i];                        
		if ( e.type=='checkbox' && e.name.indexOf('checkAll') != -1 )
		{      
		if( boolAllChecked==false)  
			e.checked= false;         
			else                        
			e.checked= true;             
		break;                            
		}                                    
	}                                     
}

function GetArrayOutOfListBox(myObj)
{
	var strIDs = "";
	var arrIDs = null;
	var sel_count = 0;
	
	for (var i = 0; i < myObj.options.length; i++)
	{			
		if (myObj.options[i].selected == true)
		{
			strIDs = strIDs + myObj.options[i].value + ",";
			sel_count++;
		}		
	}
	
	
		
	if (sel_count > 0)
	{
		strIDs = strIDs.substr(0,strIDs.length-1);		
		arrIDs = strIDs.split(",");
	}
	
	return arrIDs;
}