<!--

// Prevent Site Being Loaded into Someone elses Frameset
if (window != top) top.location.href = location.href;

// Freespace redirect
if(document.location.hostname=="freespace.virgin.net") window.location = "http://homepage.virgin.net/shalco.com/"+getFileName();var insideWindowWidth;
var strCollection = "";
var strStyleObj = "";

var isIE4 = false;
var isNav = false;
var isNav4 = false;
var isNav6 = false;
var isNav = (navigator.appName == "Netscape");
var intBrowVer = parseInt(navigator.appVersion.charAt(0));

if (isNav){
	insideWindowWidth = window.innerWidth;
	isNav4 = (intBrowVer == 4);
	if (intBrowVer == 6){
		isNav6 = true;
		strStyleObj = ".style";
	}
}	
else {
	insideWindowWidth = window.innerWidth;
	strCollection = "all.";
	strStyleObj = ".style";
	isIE4 = (intBrowVer>=4);
} 

/********************************************************************************
Convert object string/reference to a valid object
********************************************************************************/
function getObject(varRef){
	if (typeof varRef == "string") 
		if (document.all)	return document.all[varRef];
		else if (document.getElementById) return document.getElementById(varRef);
		else return eval("document." + strCollection + varRef);
	else 
		oElement = varRef;
}

/********************************************************************************
Create a Style Object - Pass it Object id
********************************************************************************/
function getObjectStyle(strName){
  if (document.all)	  return document.all[strName].style;
  else if (document.getElementById) return document.getElementById(strName).style;
  else if (document.layers)	   return  document.layers[strName];		
}

/********************************************************************************
Used for finding positions of nested objects such as TD's
********************************************************************************/
function getAbsoluteLeft(oElement){
   var oCurrentNode=oElement;
   var intLeft=0;
   while(oCurrentNode.tagName!="BODY"){
      intLeft+=oCurrentNode.offsetLeft;
      oCurrentNode=oCurrentNode.offsetParent;
   }
   //alert("Left: " + oElement.offsetLeft + "\nAbsolute Left: " + iLeft + "\nAbsolute Top: " + intTop);
   return intLeft;
}

/********************************************************************************
Used for finding positions of nested objects such as TD's
********************************************************************************/
function getAbsoluteTop(oElement){
   var oCurrentNode=oElement;
   var intTop=0;
   while(oCurrentNode.tagName!="BODY"){
      intTop+=oCurrentNode.offsetTop;
      oCurrentNode=oCurrentNode.offsetParent;
   }
   
   //alert("Left: " + oElement.offsetLeft + "\nAbsolute Left: " + iLeft + "\nAbsolute Top: " + intTop);
   return intTop;
}

/********************************************************************************
Shows PopUp Menu The Right Of the Parent Menu - Need Absolute Positioning on Divs
********************************************************************************/
function ShowRghtHndMnu(strParentMnuId, strChildMnuId){
	var intTop, intLeft, intWidth
	if (isNav4){
		var oParent = getObjectStyle(strParentMnuId);
		intTop = oParent.top;
		intLeft = oParent.left;
		intWidth = oParent.width;
		if (oParent.document.width)
		  intWidth=oParent.document.width;
		else 
		  intWidth=(oParent.clip.right - oParent.clip.left); // NS4 usually runs this
	}
	else if (isIE4){
		var oParent = getObject(strParentMnuId);
		intTop=getAbsoluteTop(oParent);
		intLeft=getAbsoluteLeft(oParent);
		var intWidth = oParent.offsetWidth;
	}
	else {
		var oParent = getObject(strParentMnuId);
		intTop = oParent.offsetTop;
		intLeft = oParent.offsetLeft;
		intWidth = oParent.offsetWidth;
	}

	// alert("intTop="+intTop+", intLeft="+intLeft+", intWidth="+intWidth);
	var oChild = getObjectStyle(strChildMnuId);
	oChild.top = intTop;
	oChild.left = intLeft+intWidth-13;
	toggle(strChildMnuId, true);	
}


/********************************************************************************
Hides or Displays a HTML Element
********************************************************************************/
function toggle(strId, blnShow){
	var strVisible, oElement;
	
	if(blnShow)
		strVisible="visible";
	else 
		strVisible="hidden";

	oElement = getObject(strId);

	if (isNav){	
		if (document.layers)
			oElement.visibility=strVisible; // typical Netscape 4
		else if (isNav6)
			oElement.style.visibility=strVisible;
		else if (document.getElementById)
			document.getElementById(strId).style.visibility=strVisible; // works also for Netscape 6
	}
	else if (document.all)
		oElement.style.visibility=strVisible; // typical Ie
} 


// old toggle function
function toggle1(myId){
    thisId = document.all(myId);
    if (thisId.style.display == "none")
       thisId.style.display = "";
    else 
       thisId.style.display = "none";
}


/********************************************************************************
Taken From Vauxhall Site - onClick="showHide('signIn','','show')
********************************************************************************/
function showHide() { //v4.0
 	var i, args=showHide.arguments;
    for (i=0; i<(args.length-2); i+=3) {
        changeVisibility(args[i],args[i+2]);
    }
}
function changeVisibility(id,value){
    // set the style of a layer/div to be visible or hidden
    if (value=="hidden" || value == "hide")  {value = "hidden";} else {value = "visible";} // be consistent with ie4
    if (document.layers) {
        if (value=="hidden")  {value = "hide";} else {value = "show";}
        var code =  "document.layers['"+ id + "'].visibility = value ";
        eval ( code );
    }else{
        var divStyle,div,failed=false;
        if (document.getElementById){
            div = document.getElementById(id);
            if(div != null){
                divStyle = div.style;
            }else{
                failed=true;
            }
        }else{
            eval ( "divStyle = "+id+".style" );
        }
        if (!failed) divStyle.visibility = value;
    }
}


function mOver(myId){
	var oId=getObject(myId);  
    oId.style.color="yellow";
}
function mOut(myId){
	var oId=getObject(myId);  
    oId.style.color="white";
}

function DivShow(id, top, left){
	var oId;
	oId = getObject(id);
	eval("oId" +strStyleObj +".top=top"); 
	eval("oId" +strStyleObj +".left=left");
}
function DivHide(id){
	var oId = getObject(id);
	eval("oId" +strStyleObj +".top=-200"); 
	eval("oId" +strStyleObj +".left=-200");
}


function isEmail(elm){

    if (elm.value.indexOf("@") != "-1" &&
        elm.value.indexOf(".") != "-1" &&
        elm.value != "-1")
        return true;
    else 
        return false;

        return false;

}


function isFilled(elm){
    if (elm.value == "" || elm.value == null)
        return false;
    else 
        return true;
}

function isInt(elm){
    var elmstr = elm.value + "";
    if (elmstr == "") return false;
    for (var i = 0; i < elmstr.length; i++) 
    {
      if (elmstr.charAt(i) < "0" || elmstr.charAt(i) > "9") 
      {
          return false;
      }
    }
    return true;
} 



function FormatPastDateCells(varTableId){
	var dtCell;
	var strShortDate=GetShortDate();
	var strYear=strShortDate.substr(6,4);
	for (lngRows=0; lngRows < varTableId.rows.length; lngRows++){
		// Get Date From 1st Cell
		dtCell = varTableId.rows(lngRows).cells(0).innerText;
		// Is It a Date ?
		if (isNaN(Date.parse(dtCell))==0){
			// Is it a 4 Digit Year ?
			if (dtCell.length <10){
			    dtCell = dtCell.substr(0,6) + strYear;
			}
			// Is Date Current
			if (strShortDate == dtCell){
				for (lngCols=0; lngCols <varTableId.rows(lngRows).cells.length; lngCols++){
					varTableId.rows(lngRows).cells(lngCols).className = "TD_CURRENT";
			    }
				return true;
			}


			// Is It in the Past ?
			if (DateDiff(strShortDate, dtCell)){
			   // Dont do last cell
			    for (lngCols=0; lngCols < varTableId.rows(lngRows).cells.length-1; lngCols++){
			         varTableId.rows(lngRows).cells(lngCols).className = "TD_PAST";
			    }
			}
			else {
				for (lngCols=0; lngCols <  varTableId.rows(lngRows).cells.length; lngCols++){
					varTableId.rows(lngRows).cells(lngCols).className =  "TD_NEXT";
				}
			    return true;
			}
		}
	}
}

 

 function DateDiff(StartDate,EndDate){
  // the year check (if year 1 > year 2)
    if (StartDate.substring(6,10) >  EndDate.substring(6,10))
        return true;
    
    // month check (if month 1 > month 2 and year 1 = year 2)
    else if ((StartDate.substring(3,5) >  EndDate.substring(3,5)) &&   
        (StartDate.substring(6,10) ==  EndDate.substring(6,10)))
        return true;
    
    // day check ( if day 1 > day 2 and month 1 = month 2)
    else if ((StartDate.substring(0,2) >=  EndDate.substring(0,2)) &&   
        (StartDate.substring(3,5) ==  EndDate.substring(3,5))&&   
        (StartDate.substring(6,10) ==  EndDate.substring(6,10))){
        return true;
    }
    
	return false;
}
 
function GetShortDate(){
    var strShortDate;
    var dtNow = new Date(Date());
    // Build Short Date String to Work in all locales
    if (dtNow.getDate() > 9) {
        strShortDate = dtNow.getDate();
    }
    else {
        strShortDate = "0" + dtNow.getDate();
    }

    if ((dtNow.getMonth()+1) > 9){
        strShortDate += "/" + (dtNow.getMonth()+1);
    }
    else {
        strShortDate += "/" + "0" + (dtNow.getMonth()+1);
    }
    strShortDate += "/" + dtNow.getYear();
    return strShortDate;
 }

function getFileName(){
	var strUrl = document.location.pathname;
	return strUrl.substring(strUrl.lastIndexOf('/')+1)
}

//-->
