// javascript code should detect which browser we
// have in order to use document.all or document.layers
// Netscape : document.theobject.visibility.
// Explorer: document.all.theobject.style.visibility

var MENU_FOCUSED = false;
var MENU_NAME = '';

var MENU_FOCUSED1 = false;
var MENU_NAME1 = '';

IE4 = (document.all) ? 1 : 0;       // browser is Internet Explorer 4
NS4 = (document.layers) ? 1 : 0;    // browser is Netscape 4

ver4 = (IE4 || NS4) ? 1 : 0;  // know that we have version 4 browser
// this will be required for non-dhtml browsers

var link1 = new Image();
var link2 = new Image();
var link3 = new Image();
var link4 = new Image();
var link5 = new Image();
var link6 = new Image();
var link7 = new Image();
var link8 = new Image();
var link9 = new Image();
var link10 = new Image();
var link11 = new Image();
var link12 = new Image();


link1.src = "/images/home_rol.jpg";
link2.src = "/images/about_rol.jpg";
link3.src = "/images/construction_rol.jpg";
link4.src = "/images/airport_rol.jpg";
link5.src = "/images/orders_rol.jpg";
link6.src = "/images/division1_rol.jpg";
link7.src = "/images/division2_rol.jpg";
link8.src = "/images/equipment1_rol.jpg";
link9.src = "/images/equipment2_rol.jpg";
link10.src = "/images/water_rol.jpg";
link11.src = "/images/division3_rol.jpg";
link12.src = "/images/equipment3_rol.jpg";

function hoverMenu(whichElement,status) {
	arrayOfLayers = ['constrauction','airp','water'];
	maxNbrOfLayers = 2;
	if (status == true) {
		setMenuFocused()
		vis = 'visible';
	}
	else if (status == false) {
		vis = 'hidden';
	}


	// checking which browser
	if (IE4) {
		for (i=0;i<maxNbrOfLayers;i++) {
			layerName = arrayOfLayers[i];
			if (layerName == whichElement) {
				// get its index first
				layerIndex = i;
				theElement = eval('document.all.'+arrayOfLayers[i]+'.style');
				theElement.visibility=vis;
			} // check if layer exists
			else {
				theElement = eval('document.all.'+arrayOfLayers[i]+'.style');
				theElement.visibility='hidden';
			} // set other layers to hidden

		} // end if for loop
	} // end of IE4

	else if (NS4) { // netscape or similar browser
		for (i=0;i<maxNbrOfLayers;i++) {
			layerName = arrayOfLayers[i];
			if (layerName == whichElement) {
				// get its index first
				layerIndex = i;
				theElement = eval("document." + arrayOfLayers[i]);
				theElement.visibility=vis;
			} // check if layer exists
			else {
				theElement = eval("document." + arrayOfLayers[i]);
				theElement.visibility='hidden';
			} // set other layers to hidden


		} // end if for loop
	} // end of NS
	else { // for Opera browser
		for (i=0;i<maxNbrOfLayers;i++) {
			layerName = arrayOfLayers[i];
			if (layerName == whichElement) {
				// get its index first
				layerIndex = i;
				theElement = eval(document.getElementById(arrayOfLayers[i])).style;
				theElement.visibility=vis;
			} // check if layer exists
			else {
				theElement = eval(document.getElementById(arrayOfLayers[i])).style;
				theElement.visibility='hidden';
			} // set other layers to hidden

		} // end if for loop
	} // end of Opera

} // end hoverOver function

function startHideMenu(whichElement) {
	MENU_FOCUSED = false;
	MENU_NAME = whichElement;
	setTimeout("hideMenu()",500);
	return;
} // end startHideMenu()

function hideMenu() {
	if (!MENU_FOCUSED) hoverMenu(MENU_NAME,false);
	return;
} // end hideMenu()

function setMenuFocused() {
	MENU_FOCUSED = true;
} // end setMenuFocused


function hoverMenu1(whichElement,status) {
	arrayOfLayers = ['gateSubmenu','birdSubmenu'];
	maxNbrOfLayers = 4;
	if (status == true) {
		setMenuFocused1()
		vis = 'visible';
	}
	else if (status == false) {
		vis = 'hidden';
	}


	// checking which browser
	if (IE4) {
		for (i=0;i<maxNbrOfLayers;i++) {
			layerName = arrayOfLayers[i];
			if (layerName == whichElement) {
				// get its index first
				layerIndex = i;
				theElement = eval('document.all.'+arrayOfLayers[i]+'.style');
				theElement.visibility=vis;
			} // check if layer exists
			else {
				theElement = eval('document.all.'+arrayOfLayers[i]+'.style');
				theElement.visibility='hidden';
			} // set other layers to hidden

		} // end if for loop
	} // end of IE4

	else if (NS4) { // netscape or similar browser
		for (i=0;i<maxNbrOfLayers;i++) {
			layerName = arrayOfLayers[i];
			if (layerName == whichElement) {
				// get its index first
				layerIndex = i;
				theElement = eval("document." + arrayOfLayers[i]);
				theElement.visibility=vis;
			} // check if layer exists
			else {
				theElement = eval("document." + arrayOfLayers[i]);
				theElement.visibility='hidden';
			} // set other layers to hidden


		} // end if for loop
	} // end of NS
	else { // for Opera browser
		for (i=0;i<maxNbrOfLayers;i++) {
			layerName = arrayOfLayers[i];
			if (layerName == whichElement) {
				// get its index first
				layerIndex = i;
				theElement = eval(document.getElementById(arrayOfLayers[i])).style;
				theElement.visibility=vis;
			} // check if layer exists
			else {
				theElement = eval(document.getElementById(arrayOfLayers[i])).style;
				theElement.visibility='hidden';
			} // set other layers to hidden

		} // end if for loop
	} // end of Opera

} // end hoverOver function

function startHideMenu1(whichElement) {
	MENU_FOCUSED1 = false;
	MENU_NAME1 = whichElement;
	setTimeout("hideMenu1()",500);
	return;
} // end startHideMenu()

function hideMenu1() {
	if (!MENU_FOCUSED1) hoverMenu1(MENU_NAME1,false);
	return;
} // end hideMenu()

function setMenuFocused1() {
	MENU_FOCUSED1 = true;
} // end setMenuFocused


//check contact form
function validateContactForm(){

	var name = document.contact.Name.value;
	var email = document.contact.Email.value;
	var comments = document.contact.Comments.value;
	var country = document.contact.Country.value;


	if (name == ''){
		alert('Please enter your name');
		document.contact.Name.focus();
		return false;
	}
	if (country == 0){
		alert('Please select country');
		document.contact.Country.focus();
		return false;
	}
	if (email == ''){
		alert('Please enter your email');
		document.contact.Email.focus();
		return false;
	}
	if (comments == ''){
		alert('Please enter your comments/orders');
		document.contact.Comments.focus();
		return false;
	}
}

function popImage(imageURL,imageTitle){

	//alert(imageURL);
	defaultWidth  = 640;
	defaultHeight = 480;
	//alert(imageURL);
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
	var optIE='scrollbars=no,width=150,height=100,left=100,top=100';

	var AutoClose = true;

	if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
		var optNN='scrollbars=yes,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
		var optIE='scrollbars=yes,resizable=1,width=150,height=100,left=100,top=100';

		//if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isNN){imgWin=window.open(imageURL,imageTitle,optNN);}
		if (isIE){imgWin=window.open(imageURL,imageTitle,optIE);}
		with (imgWin.document){
			writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
			writeln('isNN=(navigator.appName=="Netscape")?1:0;');
			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
			writeln('if (isIE){');
			writeln('window.resizeTo(100,100);');
			writeln('width=100-(document.body.clientWidth-document.images[0].width);');
			writeln('height=100-(document.body.clientHeight-document.images[0].height);');
			writeln('window.resizeTo(width,height);}');
			writeln('if (isNN){');
			writeln('window.innerWidth=document.images["Image"].width;');
			writeln('window.innerHeight=document.images["Image"].height;}}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" >');
			writeln('<img name="Image" src="'+imageURL+'" style="display:block"></body></html>');
			close();
		}
}

function FP_changePropRestore() {//v1.0
	document.getElementById('GenLayer').innerHTML = "&nbsp;";
}

function FP_changeProp(ImagePath,left) {

	document.getElementById('GenLayer').innerHTML = "<span style='padding-left:"+left+"px;'><img src='"+ImagePath+"' border='0' height='19'></span>";
}
