// MAIN MENU
/*window.onerror = null;
var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var NS4 = (bName == "Netscape" && bVer >= 4);
var IE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4);
var NS3 = (bName == "Netscape" && bVer < 4);
var IE3 = (bName == "Microsoft Internet Explorer" && bVer < 4);
var menuActive = 0
var menuOn = 0
var onLayer
var timeOn = null// LAYER SWITCHING CODE
// SHOW MENU
function showLayer(layerName,aa){
	var x =document.getElementById(aa);
	x.style.background= "rgb(101, 122, 153) url('http://hioxindia.com/images/navigation_hover.jpg') repeat scroll 0%";
	
	var tt =findPosX(x);	
	var ww =findPosY(x)+37; 
	if (timeOn != null) {
		clearTimeout(timeOn)
		hideLayer(onLayer)
	}
	if (IE4) {
		var layers = eval('document.all["'+layerName+'"].style');
		layers.left = tt;
		eval('document.all["'+layerName+'"].style.visibility="visible"');
	}
	else{
		if(document.getElementById){
			// Obtain an element reference
			var elementRef = document.getElementById(layerName);
			// Check the style object and visibility property are available.
			if((elementRef.style)&& (elementRef.style.visibility!=null))
			{
				elementRef.style.visibility = 'visible';
				elementRef.style.left = tt;
				elementRef.style.top = ww;
		  }
		}
	}
	
	onLayer = layerName
}

function hideLayer(layerName)
{
	if (menuActive == 0)
 	{
		if (IE4){
			eval('document.all["'+layerName+'"].style.visibility="hidden"');
	 	} 
   		else{
			if(document.getElementById){
				var elementRef = document.getElementById(layerName);
			  if((elementRef.style)&& (elementRef.style.visibility!=null)){
			  	elementRef.style.visibility = 'hidden';
			  }
			}
	 	}
 	}
}

function btnTimer(aa) {
	var x =document.getElementById(aa);
	x.style.background= "rgb(101, 122, 153) url('http://hioxindia.com/images/navigation_bg.jpg') repeat scroll 0%";
	timeOn = setTimeout("btnOut()",600)
}

function btnOut(layerName){
	if (menuActive == 0){
		hideLayer(onLayer)
	}
}

var item;
function menuOver(itemName){
	item=document.getElementById("tr"+itemName);
	item.style.backgroundColor = "#bfbfbf"; //background color change on mouse over  

	var item2=document.getElementById("td"+itemName);
	item2.style.backgroundImage = "url('http://hioxindia.com/img1/bullet-off.gif')"; //background color change on mouse over  

	clearTimeout(timeOn);
	menuActive = 1
}

function menuOut(itemName){
	if(item){
		item.style.backgroundColor = "#aaaaaa"; //background color change on mouse over  

		var item2=document.getElementById("td"+itemName);
		item2.style.backgroundImage = "url('http://hioxindia.com/img1/bullet-on.gif')"; //background color change on mouse over  
	}
	menuActive = 0
	timeOn = setTimeout("hideLayer(onLayer)", 100)
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
	curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}*/

var DDSPEED = 10;
var DDTIMER = 15;

// main function to handle the mouse events //
function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.display = 'block';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
  }
}

// collapse the menu //
function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}

// TABINATION
function show(ta,tabmenu)
{
	for(var i=1;i<=5;i++)
	{
	    document.getElementById('disp'+i).style.display='none';
	}
	document.getElementById(ta).style.display='block';
	
	if(tabmenu=='domain_name')
	{
		if(document.getElementById('web_hosting')!=null)
		{
			document.getElementById('web_hosting').style.backgroundImage='none';
			document.getElementById('web_hosting').style.backgroundImage='url(http://hioxindia.com/images/web_hosting_hover.jpg)';
		}
		
		if(document.getElementById('jsp_hosting')!=null)
		{
			document.getElementById('jsp_hosting').style.backgroundImage='none';
			document.getElementById('jsp_hosting').style.backgroundImage='url(http://hioxindia.com/images/jsp_hosting_hover.jpg)';
		}
		
		if(document.getElementById('virtual_server')!=null)
		{
			document.getElementById('virtual_server').style.backgroundImage='none';
			document.getElementById('virtual_server').style.backgroundImage='url(http://hioxindia.com/images/virtual_server_hover.jpg)';
		}
		
		if(document.getElementById('reseller_hosting')!=null)
		{
			document.getElementById('reseller_hosting').style.backgroundImage='none';
			document.getElementById('reseller_hosting').style.backgroundImage='url(http://hioxindia.com/images/reseller_hosting_hover.jpg)';
		}
		
		document.getElementById('domain_name').style.backgroundImage='url(http://hioxindia.com/images/domain_name.jpg)';
		document.getElementById('domain_name').style.color='#ffffff';
	}
	if(tabmenu=='web_hosting')
	{
		if(document.getElementById('domain_name')!=null)
		{
		 	document.getElementById('domain_name').style.backgroundImage='none';
			document.getElementById('domain_name').style.backgroundImage='url(http://hioxindia.com/images/domain_name_hover.jpg)';
		}
		
		if(document.getElementById('jsp_hosting')!=null)
		{
			document.getElementById('jsp_hosting').style.backgroundImage='none';
			document.getElementById('jsp_hosting').style.backgroundImage='url(http://hioxindia.com/images/jsp_hosting_hover.jpg)';
		}
		
		if(document.getElementById('virtual_server')!=null)
		{
			document.getElementById('virtual_server').style.backgroundImage='none';
			document.getElementById('virtual_server').style.backgroundImage='url(http://hioxindia.com/images/virtual_server_hover.jpg)';
		}
		
		if(document.getElementById('reseller_hosting')!=null)
		{
			document.getElementById('reseller_hosting').style.backgroundImage='none';
			document.getElementById('reseller_hosting').style.backgroundImage='url(http://hioxindia.com/images/reseller_hosting_hover.jpg)';
		}
		
		document.getElementById('web_hosting').style.backgroundImage='url(http://hioxindia.com/images/web_hosting.jpg)';
		document.getElementById('web_hosting').style.color='#ffffff';
	}
	if(tabmenu=='jsp_hosting')
	{
		if(document.getElementById('domain_name')!=null)
		{
			document.getElementById('domain_name').style.backgroundImage='none';
			document.getElementById('domain_name').style.backgroundImage='url(http://hioxindia.com/images/domain_name_hover.jpg)';
		}
		
		if(document.getElementById('web_hosting')!=null)
		{
			document.getElementById('web_hosting').style.backgroundImage='none';
			document.getElementById('web_hosting').style.backgroundImage='url(http://hioxindia.com/images/web_hosting_hover.jpg)';
		}
		
		if(document.getElementById('virtual_server')!=null)
		{
			document.getElementById('virtual_server').style.backgroundImage='none';
			document.getElementById('virtual_server').style.backgroundImage='url(http://hioxindia.com/images/virtual_server_hover.jpg)';
		}
		
		if(document.getElementById('reseller_hosting')!=null)
		{
			document.getElementById('reseller_hosting').style.backgroundImage='none';
			document.getElementById('reseller_hosting').style.backgroundImage='url(http://hioxindia.com/images/reseller_hosting_hover.jpg)';
		}
		
		document.getElementById('jsp_hosting').style.backgroundImage='url(http://hioxindia.com/images/jsp_hosting.jpg)';
	}
	if(tabmenu=='virtual_server')
	{
		if(document.getElementById('domain_name')!=null)
		{
			document.getElementById('domain_name').style.backgroundImage='none';
			document.getElementById('domain_name').style.backgroundImage='url(http://hioxindia.com/images/domain_name_hover.jpg)';
		}
		
		if(document.getElementById('web_hosting')!=null)
		{
			document.getElementById('web_hosting').style.backgroundImage='none';
			document.getElementById('web_hosting').style.backgroundImage='url(http://hioxindia.com/images/web_hosting_hover.jpg)';
		}
		
		if(document.getElementById('jsp_hosting')!=null)
		{
			document.getElementById('jsp_hosting').style.backgroundImage='none';
			document.getElementById('jsp_hosting').style.backgroundImage='url(http://hioxindia.com/images/jsp_hosting_hover.jpg)';
		}
		
		if(document.getElementById('reseller_hosting')!=null)
		{
			document.getElementById('reseller_hosting').style.backgroundImage='none';
			document.getElementById('reseller_hosting').style.backgroundImage='url(http://hioxindia.com/images/reseller_hosting_hover.jpg)';
		}
		
		document.getElementById('virtual_server').style.backgroundImage='url(http://hioxindia.com/images/virtual_server.jpg)';
	}
	if(tabmenu=='reseller_hosting')
	{
		if(document.getElementById('domain_name')!=null)
		{
			document.getElementById('domain_name').style.backgroundImage='none';
			document.getElementById('domain_name').style.backgroundImage='url(http://hioxindia.com/images/domain_name_hover.jpg)';
		}
		
		if(document.getElementById('web_hosting')!=null)
		{
			document.getElementById('web_hosting').style.backgroundImage='none';
			document.getElementById('web_hosting').style.backgroundImage='url(http://hioxindia.com/images/web_hosting_hover.jpg)';
		}
		
		if(document.getElementById('jsp_hosting')!=null)
		{
			document.getElementById('jsp_hosting').style.backgroundImage='none';
			document.getElementById('jsp_hosting').style.backgroundImage='url(http://hioxindia.com/images/jsp_hosting_hover.jpg)';
		}
		
		if(document.getElementById('virtual_server')!=null)
		{
			document.getElementById('virtual_server').style.backgroundImage='none';
			document.getElementById('virtual_server').style.backgroundImage='url(http://hioxindia.com/images/virtual_server_hover.jpg)';
		}
		
		document.getElementById('reseller_hosting').style.backgroundImage='url(http://hioxindia.com/images/reseller_hosting.jpg)';
		document.getElementById('reseller_hosting').style.color='#ffffff';
	}
}

// CUSTOMER LIST
var top=0;
var totalimg=0;
function mover(df){
 alert("Hi");
	if(df == 'up'){
	 alert("UP");
		if(top+4 < totalimg){
		 alert(top);
		for(var gh=0; gh<4; gh++){
			var top1 = document.getElementById('a'+gh);
			top1.src=rImg1[gh+top+1].src;
		}
		top=top+1;
		}
	}

	if(df == 'down'){
	 alert("DOWN");
		if(top > 0){
		for(var gh=0; gh<4; gh++){
			var top1 = document.getElementById('a'+gh);
			top1.src=rImg1[gh+top-1].src;
		}
		top=top-1;
		}
	}
}
