is = new Object()
is.agent = navigator.userAgent.toLowerCase()
is.op = (is.agent.indexOf("opera") != -1)
if (is.op) {
	is.op7 = (is.op && is.agent.indexOf("opera 7") != -1)
	is.op8 = (is.op && is.agent.indexOf("opera 8") != -1)
	is.op9 = (is.op && is.agent.indexOf("opera/9") != -1)
} else {
	is.ie7 = (is.agent.indexOf("msie 7") != -1)
	is.ie6 = (is.agent.indexOf("msie 6") != -1)
	is.ie55 = (is.agent.indexOf("msie 5.5") != -1)
	is.ie5 = (!is.ie55 && is.agent.indexOf("msie 5") != -1)
	is.ns7 = (is.agent.indexOf("netscape/7") != -1)
	is.ns6 = (is.agent.indexOf("netscape/6") != -1)
	is.moz = (!is.ns7 && !is.ns6 && is.agent.indexOf("gecko") != -1)
	is.ffox = (is.agent.indexOf("firefox") != -1)
}
is.ie = (is.ie5 || is.ie55 || is.ie6 || is.ie7)
is.ns = (is.ns6 || is.ns7 || is.moz || is.ffox)
is.dom = (is.ie || is.ns || is.op7 || is.op8 || is.op9)

//window.focus()
/* -- alert removed -- anil - 30 april 2008
if (!is.dom && !is.op) {
	alert("You are not using a standards compliant browser or are using an older browser.\r\nYou may not be able to view ITP.net in it's entirety and will not be able to use certain functions as intended or not at all.\r\n\r\nPlease upgrade you browser to one of the latest versions of either Internet Explorer, Netscape, Mozilla or Opera.")
}
*/
var contarr=new Array();

contarr=["Bahrain","Egypt","Iran","Iraq","Jordan","Kuwait","Oman","Qatar","Saudi Arabia","Syria","United Arab Emirates","Yemen","-----------------","Algeria","Lebanon","Libya","Morocco","Tunisia","-----------------","Canada","France","Germany","Ireland","Italy","Spain","Sweden","Switzerland","United Kingdom","USA","-----------------","Afghanistan","Albania","Andorra","Angola","Anguilla","Antigua & Barbuda","Argentina","Armenia","Aruba","Australia","Austria","Azerbaijan","Bahamas","Bangladesh","Barbados","Belarus","Belgium","Belize","Benin","Bermuda","Bhutan","Bolivia","Bosnia","Botswana","Bougainville","Brazil","British Virgin Islands","Brunei","Bulgaria","Burkina Faso","Burundi","Cambodia","Cameroon","Cape Verde","Cayman Islands","Central African Rep.","Chad","Channel Islands","Chile","China","Christmas Island","Colombia","Comoros","Congo","Cook Islands","Costa Rica","Croatia","Cuba","Cyprus","Czech Republic","Denmark","Djibouti","Dominica","Dominican Republic","Ecuador","El Salvador","Equatorial Guinea","Eritrea","Estonia","Ethiopia","Faeroe Islands","Falkland Islands","Fiji","Finland","French Guiana","French Polynesia","Gabon","Gambia","Georgia","Ghana","Gibraltar","Greece","Greenland","Grenada","Guadeloupe","Guatemala","Guinea-Bissau","Guyana","Haiti","Holy See","Honduras","Hong Kong","Hungary","Iceland","India","Indonesia","Isle of Man","Ivory Coast","Jamaica","Japan","Johnston Island","Kazakhstan","Kenya","Kirghizia","Kiribati","Laos","Latvia","Lesotho","Liberia","Liechtenstein","Lithuania","Luxembourg","Macao","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Malta","Martinique","Mauritania","Mauritius","Mayotte","Mexico","Micronesia","Midway Islands","Moldavia","Monaco","Mongolia","Montenegro","Montserrat","Mozambique","Myanmar","Namibia","Nauru","Nepal","Netherlands","Netherlands Antilles","New Caledonia","New Zealand","Nicaragua","Niger","Nigeria","Niue Island","Norfolk Island","North Cyprus","North Korea","Norway","Pakistan","Palestine","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Pitcairn Islands","Poland","Portugal","Queen Maud Land","Reunion","Romania","Ross Dependency","Russia","Rwanda","Sahara","Saint Helena","Saint Lucia","Samoa","San Marino","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Slovakia","Slovenia","Solomon Islands","Somalia","Somaliland","South Africa","South Korea","Spanish North Africa","Sri Lanka","Sudan","Suriname","Swaziland","Taiwan","Tajikistan","Tanzania","Thailand","Timor","Togo","Tokelau Islands","Tonga","Trinidad & Tobago","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","Uruguay","Uzbekistan","Vanuatu","Vatican City State","Venezuela","Vietnam","Wake Island","Zaire","Zambia","Zimbabwe"]

function congen(cnt, selected) {
	if(cnt=="-----------------") {
		document.write('<option value="">'+cnt+'</option>');	
	} else {
		if (cnt == selected){
			document.write('<option value="'+cnt+'" selected>'+cnt+'</option>');
		} else if(selected == 'selected') {
		    document.write('<option value="'+cnt+'" selected>'+cnt+'</option>');
		} else{
		   document.write('<option value="'+cnt+'">'+cnt+'</option>');
		}
	}	
}


function setStatus(sText) {
  window.status = sText;
  return true;
}


// open external sites

function popSite(wPage) {
	openWindow(wPage,600,400,'yes');
}


// jump window

function jumpTo(wSelect,wWindow) {
	wURL = wSelect.options[wSelect.selectedIndex].value
	if (wURL != '') {
		if (wWindow == 'new') {
			popSite('http://www.' + wURL)
		}
		else {
			document.location.href = wURL
		}
	}
}


// window opener

function openWindow(wPage,width,height,resize) {
  window.open(wPage,'window','toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=' + resize + ',channelmode=no,directories=no,width=' + width + ',height=' + height + ',top=10,left=10');
}

function openPicWindow(wPage,width,height,resize) {
  window.open(wPage,'window','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=' + resize + ',channelmode=no,directories=no,width=' + width + ',height=' + height + ',top=10,left=10');
}

//bookmark / add to favourites

function bookmarkPage(sTitle,wPage) {
	if(document.all) {
		window.external.AddFavorite(wPage, sTitle);
	}
	else if(window.sidebar) {
		window.sidebar.addPanel(sTitle, wPage, "")
	}
}

// email to a friend

function emailThis(wSection) {
	document.location.href = '/tools/email.php?wSection=' + wSection
}


//=====================================================================
//  DOM Image Rollover v3 (hover)
//
//  Demo: http://chrispoole.com/scripts/dom_image_rollover_hover
//  Script featured on: Dynamic Drive (http://www.dynamicdrive.com)
//=====================================================================
//  copyright Chris Poole
//  http://chrispoole.com
//  This software is licensed under the MIT License 
//  <http://opensource.org/licenses/mit-license.php>
//=====================================================================

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgPreload2=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('domroll')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			if (imgClass[i].match(/domroll (\S+)/)) {
				imgPreload[i]=new Image();
				imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]
			}
			if (imgClass[i].match(/domclick (\S+)/)) {
				imgPreload2[i]=new Image();
				imgPreload2[i].src = imgClass[i].match(/domclick (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			
			
			imgarr[i].onmousedown=function(){
				var o = this.className.match(/domclick (\S+)/);
				(o) ? this.setAttribute('src',[1]) : '';
			}
			imgarr[i].onmouseover=function(){
				var o = this.className.match(/domclick (\S+)/);
				(o) ? this.setAttribute('src',[1]) : '';
			}
			imgarr[i].onmouseout=function(){
				var o = this.className.match(/domclick (\S+)/);
				(o) ? this.setAttribute('src',[1]) : '';
			}
		}
	}
}


// cell rollover functions with submenu

function initNav() {
	var nav = document.getElementById('topnav')
	var navLinks = nav.getElementsByTagName('a')
	for (i=0;i<navLinks.length;i++) {
		if(navLinks[i].getAttribute("href") == 'javascript:;') {
			navLinks[i].setAttribute("id", "servicesLink")
			navLinks[i].onmouseover = new Function("navOver(document.getElementById('services_submenu'))")
			navLinks[i].onmouseout = new Function("navOut(document.getElementById('services_submenu'))")
		}
	}
	var navDivs = document.getElementById('services_submenu')
	navDivs.onmouseover = new Function("subnavOver(document.getElementById('services_submenu'))")
	navDivs.onmouseout = new Function("subnavOut(document.getElementById('services_submenu'))")
}

function navOver(eObj) {
  var wDiv = eObj
	if(wDiv) {
		wDiv.style.visibility = 'visible'
		document.getElementById('servicesLink').style.backgroundColor = '#8c9696'
		if (is.ie) {
			var allSelect = document.body.getElementsByTagName("select")
			for(i = 0; i < allSelect.length; i++) {
				if(allSelect[i].getAttribute("nohide") != 1) {
					allSelect[i].style.visibility = "hidden"
				}
			}
		}
	}
}	

function navOut(eObj) {
  var wDiv = eObj
	if(wDiv) {
		wDiv.style.visibility = 'hidden'
		document.getElementById('servicesLink').style.color = '#333333'
		document.getElementById('servicesLink').style.backgroundColor = 'transparent'
		if (is.ie) {
			var allSelect = document.body.getElementsByTagName("select")
			for(i = 0; i < allSelect.length; i++) {
				if(allSelect[i].getAttribute("nohide") != 1) {
					allSelect[i].style.visibility = "visible"
				}
			}
		}
	}
}	

function subnavOver(eObj) {
	navOut(eObj)
	navOver(eObj)
}	

function subnavOut(eObj) {
	navOver(eObj)
	navOut(eObj)
}	


function openBox(openDiv, arrowDiv, contractImg, expandImg)
{
	var div = document.getElementById(openDiv);
	var img = document.getElementById(arrowDiv); 
	if (div.style.display == 'block') {
		div.style.display  = 'none';
		img.src = '/templates/ahlan.ae/pictures/buttons/'+expandImg+'.gif'; 
		if (openDiv=='ahlan_loves') {
		var div_open = document.getElementById('poll');
		var arrow_open = document.getElementById('plus3');
		div_open.style.display  = 'block';
		arrow_open.src = '/templates/ahlan.ae/pictures/buttons/minus_yellow.gif'; 
		}
		if (openDiv=='ahlan_hates') {
		var div_open = document.getElementById('poll');
		var arrow_open = document.getElementById('plus3');
		div_open.style.display  = 'block';
		arrow_open.src = '/templates/ahlan.ae/pictures/buttons/minus_yellow.gif'; 
		}
		if (openDiv=='quotes') {
		var div_open = document.getElementById('poll');
		var arrow_open = document.getElementById('plus3');
		div_open.style.display  = 'block';
		arrow_open.src = '/templates/ahlan.ae/pictures/buttons/minus_yellow.gif'; 
		}
		if (openDiv=='poll') {
		var div_open = document.getElementById('ahlan_loves');
		var arrow_open = document.getElementById('plus1');
		div_open.style.display  = 'block';
		arrow_open.src = '/templates/ahlan.ae/pictures/buttons/minus_yellow.gif'; 
		}
		
	} else {
		div.style.display  = 'block';
		img.src = '/templates/ahlan.ae/pictures/buttons/'+contractImg+'.gif'; 
	}
}

function closeBox(div1,div2, div3)
{
	var div1 = document.getElementById(div1);
	var div2 = document.getElementById(div2);
	var div3 = document.getElementById(div3);
	if(div1) div1.style.display  = 'none';
	if(div2) div2.style.display  = 'none';
	if(div3) div3.style.display  = 'none';
	
	var img1 = document.getElementById('plus1');
	var img2 = document.getElementById('plus2');
	var img3 = document.getElementById('plus3');
	var img4 = document.getElementById('plus4');
	if (img1)  { img1.src = '/templates/ahlan.ae/pictures/buttons/plus_yellow.gif';}
 	if (img2)  { img2.src = '/templates/ahlan.ae/pictures/buttons/plus_yellow.gif';}
 	if (img3)  { img3.src = '/templates/ahlan.ae/pictures/buttons/plus_yellow.gif';}
 	if (img4)  { img4.src = '/templates/ahlan.ae/pictures/buttons/plus_yellow.gif';}	
}

function openMenuBox(openDiv, arrowDiv, contractImg, expandImg)
{
	var div = document.getElementById(openDiv);
	//var img = document.getElementById(arrowDiv); 
	var img2 = document.getElementById('bottomimg');
	
	div.style.display  = 'block';
	//img.src = '/templates/ahlan.ae/pictures/icons/'+contractImg+'.gif'; 
	//img2.style.display = 'block';
	
	/*if (div.style.display == 'block') {
		div.style.display  = 'none';
		img.src = 'pictures/icons/'+expandImg+'.gif'; 
		img2.style.display = 'none';
	} else {
		div.style.display  = 'block';
		img.src = 'pictures/icons/'+contractImg+'.gif'; 
		img2.style.display = 'block';
	}*/
}

function closeMenuBox()
{
	var div = document.getElementById('more');
	div.style.display  = 'none';
	var img1 = document.getElementById('arrowimg');
	var img2 = document.getElementById('bottomimg');
	img1.src = '/templates/ahlan.ae/pictures/icons/arrow_white_down.gif'; 
	img2.style.display = 'none';

	
}

function closeMainMenuBox()
{
	var div = document.getElementById('menu-more');
	div.style.display  = 'none';
}


/* 
function openRefineBox()
{
	var div = document.getElementById('refine_industry');
	var img = document.getElementById('arrowimg'); 
	if (div.style.display == 'block') {
		div.style.display  = 'none';
		img.src = 'pictures/jobs/arrow_white_down.gif'; 
	} else {
		div.style.display  = 'block';
		img.src = 'pictures/jobs/arrow_white_up.gif'; 
	}
}
*/
