
function navto(str){
	document.location.href=str
}
function calmenuleft(imgid){
	var LL = findObj(imgid)
	var xPos = eval(LL).offsetLeft;
	var tempEl = eval(LL).offsetParent;
  	while (tempEl != null) {
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
	return xPos;
}
function calmenutop(imgid){
	var TT = findObj(imgid)
	var yPos = eval(TT).offsetTop;
	var tempEl = eval(TT).offsetParent;
  	while (tempEl != null) {
  		yPos += tempEl.offsetTop;
  		tempEl = tempEl.offsetParent;
  	}
	return yPos;
}

function reposmenus(){
   top.location.reload();
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function tmt_formManager(f,c){
	if(MM_findObj(f)){eval("MM_findObj('"+f+"')."+c);}
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function close_window() {
    window.close();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  popup=window.open(theURL,winName,features);
}

function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}
function openPictureWindow_Fever(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src='+imageName+' width='+imageWidth+' height='+imageHeight+' alt='+alt+'>'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}
function showproject(obj){
	tableclass=obj.className
	obj.className="project_item_active"
}
function resetproject(obj){
	obj.className=tableclass
}
function Navtoproject(str){
	MM_goToURL('parent',str);return document.MM_returnValue
}
function veiwnews(str,pheight){
	var width="450"
	pheight=eval(pheight+100);
	CloseBut=eval(pheight-50);
    var left = (screen.width/2) - width/2;
    var top = (screen.height/3) - pheight/2;
    MM_openBrWindow(str+'&winheight='+CloseBut,'','top='+top+',left='+left+',width=450,height='+pheight)
}
function saverecord(){
	document.getElementById('status').value="saved"
	tmt_formManager('former','submit()')
}
function publishrecord(){
	document.getElementById('status').value="published"
	tmt_formManager('former','submit()')
}
function confirmdelete(str){
	confirmation=confirm('Are you sure you wish to delete this record?');
	if(confirmation==true){
		document.getElementById('cmd').value="del"
		document.getElementById('id').value=str
		tmt_formManager('submitter','submit()')
	}
}
function tmt_formAction(f,p){
	if(MM_findObj(f)){eval("MM_findObj('"+f+"').action='"+p+"'");}
}
function sendform(){
	tmt_formAction('former','mail.php');
	tmt_formManager('former','submit()');
}
function hideBar(){
	document.getElementById('Procject_Bar').className="hidden"
}
function resetformdetails(){
	document.getElementById('jobtitle').className="";
	document.getElementById('EmailTemplate').value="Job_Enquiry_Template.htm";
	document.getElementById('Subject').value="Employment Enquiry";
	document.getElementById('message').innerHTML="Complete the form below if you would like to enquire about this vacancy.";
}
//Link to Admin
function gotoadmin(){
	MM_goToURL('parent','Admin/Login.php');return document.MM_returnValue;
}
//Project Categories
function swapCat(str){
	MM_goToURL('parent',str);return document.MM_returnValue;
}
function pullMainCategories(str){
	if(!str){
		return false;
	}
	var subcats=document.getElementById('subcat');
	if(subcats){
		subcats.selectedIndex=0;
	}
	tmt_formManager('ProjectSearcher','submit()');
}
function pullSubCategories(str){
	if(!str){
		return false;
	}
	if(str=="displayall"){
		var subcats=document.getElementById('subcat');
		subcats.selectedIndex=0;
	}
	tmt_formManager('ProjectSearcher','submit()');
}