intervalid = 0;
 function navbar_switch(imgobj, mouse_event,num){
  var img_src = imgobj.src;
  var new_img_src = "";
  if (mouse_event == "over"){
    clearfunction(2);   
   new_img_src = img_src.replace(/_off/,"_on");
     imgobj.src = new_img_src;
   if (num == 13){
    ;
   }else if (num == 1){
    document.getElementById("img2").src = "/images/newnav/vbar_on.png";
   }else{
    num1 = num - 1;
    num2 = num + 1;
    document.getElementById("img" + num1).src = "/images/newnav/vbar_on.png";
    document.getElementById("img" + num2).src = "/images/newnav/vbar_on.png";
   }
   
  }else if (mouse_event == "out"){
   new_img_src = img_src.replace(/_on/,"_off");
     imgobj.src = new_img_src;
   if (num == 13){
    ;
   }else if (num == 1){
    document.getElementById("img2").src = "/images/newnav/vbar_on.png";
   }else{
    num1 = num - 1;
    num2 = num + 1;

    document.getElementById("img" + num1).src = "/images/newnav/vbar_off.png";
    document.getElementById("img" + num2).src = "/images/newnav/vbar_off.png";
   }
   
  }else if (mouse_event == "subover"){
    flag = 0;
    new_img_src = img_src.replace(/_off/,"_on");
      imgobj.src = new_img_src;
  }else{
    flag = 1;
    new_img_src = img_src.replace(/_on/,"_off");
      imgobj.src = new_img_src;
  }

 }
 function navbar_about(imgobj, mouse_event){
    //alert(2);
    if (mouse_event == "over"){
        flag = 0;
        navbar_switch(imgobj, mouse_event, 1);
        document.getElementById("submenu").style.visibility = "visible";
        document.getElementById("img2").src = "/images/newnav/vbar_on.png";
    }else{
        flag = 1;
        intervalid = window.setInterval("clearfunction(1)", timegap)
       // alert(intervalid);
    }
 }
 function cleartxt(){
  if (document.getElementById("name").value == 'optional'){
    document.getElementById("name").value = "";
  }
 }
 function clearfunction(val){
    if (flag == 1){
        //alert(1);
      if(intervalid){
        document.getElementById("about_img").src = "/images/newnav/home_off.png";
        document.getElementById("img2").src = "/images/newnav/vbar_off.png";
        document.getElementById("submenu").style.visibility = "hidden";
        flag = 0;
        window.clearInterval(intervalid);
        intervalid = 0;
      }
    }
    
 }
  icontimeout = 0;
  boxtimeout = 0;
 function switch_icon(){
  if(icontimeout != 0){
    clearTimeout(icontimeout);
    icontimeout = 0;
  }
  var obj = document.getElementById("ficon");
  obj.src='plusa.gif';
  boxtimeout = setTimeout("show_box()", 2000);
 }
 icontimeout = 0;
 function icon_back(){
  icontimeout=setTimeout("aaa()",200);
 }
 function aaa(){
  if (icontimeout > 0){
 
  var obj=document.getElementById("ficon");
  obj.src = 'plus.gif';
  icontimeout = 0;
  }
}
 function sub_navbar(obj,mouse_event){
    if (mouse_event == "out"){
        obj.style.visibility = "hidden";
    }
 }
 function setflag(val){
    flag = val;
 }
 
 
function startajax(){
    var  obj = document.getElementById("iconmsg");
    obj.innerHTML = '<img src="/images/ajax-loader.gif"> ';
    var result;
    var parameter = get_data(['name','email','message']);
    if (parameter ){
    var xmlHttp=null;
	try{    xmlHttp=new XMLHttpRequest();  }// Firefox, Opera 8.0+, Safari
	catch (e) { 														// Internet Explorer
	    try {	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e){	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
  		}
	if (xmlHttp==null){ alert("Your browser does not support AJAX!"); exit; } 
    else { 
	myurl = 'iconajax.php' + parameter;
	xmlHttp.open("GET", myurl, true);
        xmlHttp.onreadystatechange =  function (){ 
            if (xmlHttp.readyState==4 && xmlHttp.status == 200){ 
                result =  xmlHttp.responseText;
                var  divobj = document.getElementById("msgwin");
                if (result == "ok"){ divobj.innerHTML = '<br><br>Message is sent. Thank you for your input.<br><br>Message window will close in (<span id="close_counter" style="color:gray">5</span>) seconds.<br><br><br>';
                  close_win(5);
                }
                else{divobj.innerHTML ='Error occurred, Please try again<br> later.Thank you.';}
                
            }
        }
        xmlHttp.send(null);
    }
}}
function close_win(para){
  close_time = para;
  
  var win_obj = document.getElementById("close_counter");
  win_obj.innerHTML = close_time;
  
  if(close_time > 0){
    close_time = close_time - 1;
    
    setTimeout("close_win(close_time)",1000);
  }else{
    slowlow();
  }
}

function get_data(array){
    var str = "";
    var tmparr = new Array();
    var tmp = "";
    for(x in array){
 
        tmp = document.getElementById(array[x]).value;
        if (tmp == ""){ tmp = "-"; }
        if (x == 0 && tmp == "-"){alert("Please enter you name"); return false;}
        if ((x == 2) && tmp == "-"){ alert("Can't send a empty messgae"); return false;}
        tmparr[x] = array[x] + "=" + encodeURI(tmp);
    }
    str = tmparr.join("&");
    str = "?" + str;
    return str;
}


/***********************************************
* Gradual Highlight image script-  Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var baseopacity=100
var flag_open = 0;

function slowhigh(){

  if (flag_open == 0){
  flag_open = 1;
  document.getElementById("abox").style.display = "inline";
  document.getElementById("bubble").style.visibility = "visible";
mainWin = document.getElementById("mainW");
browserdetect=mainWin.filters? "ie" : typeof mainWin.style.MozOpacity=="string"? "mozilla" : "";
instantset(baseopacity)
highlighting=setInterval("gradualfade(mainWin)",100)
}}

function slowlow(){
  if (flag_open == 1){
document.getElementById("bubble").style.visibility = "hidden";
document.getElementById("abox").style.display = "none";
cleartimer();
instantset(baseopacity)
flag_open = 0;
}
}
function instantset(degree){
  mainWin = document.getElementById("mainW");

if (browserdetect=="mozilla")
mainWin.style.MozOpacity=degree/100;
else if (browserdetect=="ie")
mainWin.filters.alpha.opacity=degree;
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity>0.3)
cur2.style.MozOpacity=Math.max(parseFloat(cur2.style.MozOpacity)-0.1, 0.3)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity>30){
  cur2.filters.alpha.opacity -= 10;
}
else if (window.highlighting)
clearInterval(highlighting)
}


