﻿var loaded = 0;
var baseURL = "http://www.agri-labourpool.com/";

var sitedomain = "agri-labourpool.com";

function rand(l,u) // lower bound and upper bound
 {
     return Math.floor((Math.random() * (u-l+1))+l);
 }
 
function doheaderimg(){

    if (HeaderIMG != "") {
        document.images.headerimage.src = "images/headers/selectable/" + HeaderIMG;
    } else {

        URL = window.location.href;

        var pagename_array = URL.split("/");
        var barefile_array = pagename_array[3].split(".");
        var result = barefile_array[0];

        if (result == "index" || result == "" || !result) {
            result = "home";
        }
        else {


            result = rand(1, 18);
        }

        document.images.headerimage.src = "images/headers/" + result + ".jpg";
    }
}


        var timerID = null;
		var timerOn = false;
		var timecount = 0;
		var what = null;
		var newbrowser = true;
		var check = false;

    	function init(){
    	//  alert ("Running Init");
          if (document.layers) {
                      //  alert ("Running Netscape 4");
                        layerRef="document.layers";
                        styleSwitch="";
                        visibleVar="show";
			screenSize = window.innerWidth;
			what ="ns4";


          }else if(document.all){
                      //  alert ("Running IE");
                        layerRef="document.all";
                        styleSwitch=".style";
                        visibleVar="visible";
			screenSize = document.body.clientWidth + 18;
			what ="ie";

		  }else if(document.getElementById){
                      //  alert ("Running Netscape 6");
                        layerRef="document.getElementByID";
                        styleSwitch=".style";
                        visibleVar="visible";
			what="moz";
		  
		  }else{
		  	//alert("Older than 4.0 browser.");
			what="none";
			newbrowser = false;
		  }
		  
 
		//window.status='status bar text to go here';
		check = true;
  	 	}
	// Turns the layers on and off
        function showLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
	        	else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="visible";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
                  }
		 }
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
		}

        function hideLayer(layerName){
        	if(check){
        		if (what =="none"){
        			return;
        			}
        		else if (what == "moz"){
        			document.getElementById(layerName).style.visibility="hidden";
        			}
        		else{
                  eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
				}
        
        	}
        	else {// alert ("Please wait for the page to finish loading.");
        		return;}
        }

		function hideAll(){
				hideLayer('seekers');
				//hideLayer('employers');
		}
		
		function startTime() {
	        if (timerOn == false) {
                timerID=setTimeout( "hideAll()" , timecount);
                timerOn = true;
	        }
		}

		function stopTime() {
	        if (timerOn) {
		        clearTimeout(timerID);
	            timerID = null;
	            timerOn = false;
	        }
		}

function bookmark(page,title) {
 window.external.AddFavorite(page, title)
}

function externalLinks() { 

if (!document.getElementsByTagName) return; 

var anchors = document.getElementsByTagName("a"); 
for (var i=0; i<anchors.length; i++) { 
var anchor = anchors[i]; 
var relvalue = anchor.getAttribute("rel");

if (anchor.getAttribute("href")) {
var external = /external/;
var relvalue = anchor.getAttribute("rel");
if (external.test(relvalue)) { anchor.target = "_blank"; }
} 
}
} 

function createcontact(alias,sitedomain){
contact = '<a href="mailto:' + alias + '@' + sitedomain + '">';
contact = contact + alias + "@" + sitedomain;
contact = contact + '</a>';
}

