// check for browsers
var ns4 = (document.layers);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);


//  Email validation start
function email_validate()
{
 if (document.registration.email.value <=null) 
    {
  	
  	document.registration.email.focus();
  	document.registration.email.select();
  	return false;
        go_back();
    }
    else 
    {
     var retval = validEmail(document.registration.email.value)
      if (retval == false)
		{
			document.registration.email.select();
			document.registration.email.focus();
			return false;
                        go_back();
		}
if (testresults == true) { return true;}
    }
}
    function validEmail(){
         var testresults
         var str=document.registration.email.value
         var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
         if (filter.test(str))
         testresults=true;
          else{
          alert("Enter a valid email!");
          testresults=false;
              }
return (testresults)
}  

// Email validation end
function popup_hori()
{
   var posx = (screen.width/2) - (500/2);
   var posy = (screen.height/2) - (600/2) -20;
   var settings = width=400,height=300,toolbar=no,location=no,resizable=yes,directories=no,status=no,menubar=no,scrollbars=yes,top='+posy+',left='+posx+';
    var url;
   url="http://www.joshitech.com/sw_download/JTIHorizontal.msi";
   window.open(url,settings,target='_blank');
  }

function popup_multi()
{
   var posx = (screen.width/2) - (500/2);
   var posy = (screen.height/2) - (600/2) -20;
   var settings = width=400,height=300,toolbar=no,location=no,resizable=yes,directories=no,status=no,menubar=no,scrollbars=yes,top='+posy+',left='+posx+';
    var url;
  url="http://www.joshitech.com/sw_download/MultiInstall.exe";
   window.open(url,settings,target='_blank');  
}

function popup_proc()
{
   var posx = (screen.width/2) - (500/2);
   var posy = (screen.height/2) - (600/2) -20;
   var settings = width=400,height=300,toolbar=no,location=no,resizable=yes,directories=no,status=no,menubar=no,scrollbars=yes,top='+posy+',left='+posx+';
    var url;
  url="http://www.joshitech.com/sw_download/procone.msi";
   window.open(url,'',settings,target='_blank');   
}

// start of timeron / off -----------------
   var timerID = null;
   var timerOn = false;
   var timecount = 2000;
function startTime() 
{
       if (timerOn == false)
          {
                timerID=setTimeout( "hideAll()" , timecount);
                timerOn = true;
          }
 }
function hideAll()
 {
    hideconsult();
    hidesoftware();
 }
// timeroff ------------------------------------------------
function stopTime() 
{
        if (timerOn)
        {
            clearTimeout(timerID);
            timerID = null;
            timerOn = false;
        }
}
//---------------end of timer on / off -----------
// getting the current file
   var f_name = window.location.href;
   var loc = window.location.href.split("/").slice(4);
// getting the current file ends
function sub_consultancy()
{
  var cons_left;
  if ((ns4) || (ns6)) 
  { ns_consult(); }
  else
  { ie_consult(); }
}
function ns_consult()
{
   if (innerWidth  > 800)
     
        { cons_left = 424; }
   else
        { cons_left = 320; }
document.write("<table width=140 cellpadding=3 cellspacing=0 border=0 HEIGHT=15px STYLE='position:absolute; left:"+cons_left+ ";top:1'>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='projects.htm'>Projects</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onmouseout='sub_off(this);'onClick=window.location.href='publications.htm'>Publications</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='training.htm'>Training</td>");
document.write("</tr>");
document.write("</table>");
}
function ie_consult()
{
     if ((loc == "horizontal.htm") || (loc == "publications.htm"))
       { cons_left = 280; }
     else if (loc == "ahwt_course.htm")
       { cons_left = 285; }
     else if ((loc == "faq.htm") || (loc == "register_hori.asp") || (loc == "register_multi.asp") || (loc == "register_proc.asp"))
       { cons_left = 230; }
     else if (loc == "projects.htm")
       { cons_left = 181; }
     else if (loc == "procone.htm") 
       { cons_left = 255; }
     else
       { cons_left = 310; }
document.write("<table width=140 cellpadding=3 cellspacing=0 border=0 HEIGHT=15px STYLE='position:absolute; left:"+cons_left+ ";top:1'>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='projects.htm'>Projects</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onmouseout='sub_off(this);'onClick=window.location.href='publications.htm'>Publications</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='training.htm'>Training</td>");
document.write("</tr>");
document.write("</table>");
}
function sub_software()

{
    var soft_left;
    
   if  ((ns4) || (ns6))
   { ns_software();}
  else
   { ie_software();}

}

function ns_software()
{
   if (innerWidth  > 800)
    
       { soft_left = 273; }
   else
       { soft_left = 168; }
document.write("<table width=140 cellpadding=3 cellspacing=0 border=0 HEIGHT=15px STYLE='position:absolute; left:"+soft_left+ ";top:1'>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='multilateral.htm'>JTI Multilateral</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onmouseout='sub_off(this);'onClick=window.location.href='horizontal.htm'>JTI Horizontal</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this)' onClick=window.location.href='procone.htm'>Procone</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='faq.htm'>FAQ</td>");
document.write("</tr>");
document.write("</table>");
}

function ie_software()

{
    
    if ((loc == "horizontal.htm") || (loc == "publications.htm"))
     { soft_left=128;}
    else if (loc == "ahwt_course.htm")
     { soft_left=132;}
    else
    if ((loc == "faq.htm") || (loc == "register_hori.asp") || (loc == "register_multi.asp") || (loc == "register_proc.asp"))
     { soft_left = 78; }
    else if (loc == "projects.htm")
     { soft_left = 29; }
    else if (loc == "procone.htm")
     { soft_left = 102; }
    else
     { soft_left=158;}
   
 
document.write("<table width=140 cellpadding=3 cellspacing=0 border=0 HEIGHT=15px STYLE='position:absolute; left:" +soft_left+ ";top:1'>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='multilateral.htm'>JTI Multilateral</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onmouseout='sub_off(this);'onClick=window.location.href='horizontal.htm'>JTI Horizontal</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='procone.htm'>Procone</td>");
document.write("</tr>");
document.write("<tr>");
document.write("<td width=140 class=but onMouseover='sub_on(this);' onMouseout='sub_off(this);' onClick=window.location.href='faq.htm'>FAQ</td>");
document.write("</tr>");
document.write("</table>");
}

function open_iitb()
{
   var posx = (screen.width/2) - (500/2);
   var posy = (screen.height/2) - (600/2) -20;
   var settings = 'width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,top='+posy+',left='+posx+'';
   var url= "http://www.alumni.iitb.ac.in/dist_alumni/dist_alu_2003.htm#joshi";
   
   window.open(url,'',settings);
}
function open_pennwell()
{
   var posx = (screen.width/2) - (500/2);
   var posy = (screen.height/2) - (600/2) -20;
   var settings = 'width=500,height=400,toolbar=no,location=no,resizable=yes,directories=no,status=no,menubar=no,scrollbars=yes,top='+posy+',left='+posx+'';
   var url="http://store.yahoo.com/pennwell/horweltec.html";
   window.open(url,'',settings);
}

function go_back()
{
history.go(-1);return "  "
}

function show_on(thisTD)
 {
   thisTD.style.color='#FFFFF0';
   thisTD.style.backgroundColor='#000099';
 }
function show_off(thisTD)
 {
  thisTD.style.color='#000099';
  thisTD.style.backgroundColor='#FFFFF0';
 }
function show_off_hl(thisTD)
 {
  thisTD.style.color='#FFFFF0';
  thisTD.style.backgroundColor='#000099';
 }
function sub_on(thisTD)
 {
   thisTD.style.color='#FFFFF0';
   thisTD.style.backgroundColor='#000099';
 }
function sub_off(thisTD)
 {
  thisTD.style.color='#000099';
  thisTD.style.backgroundColor='#FFFFF0';
 }
function link_off(thisTD)
 {
   thisTD.style.color='#999999';
 }
function link_on(thisTD)
 {
  thisTD.style.color='#FF9900';
 }
function write_footer()
{
document.write("<table width=100% border=0 cellpadding=0 cellspacing=0 bgcolor='#FFFFFF'>");
document.write("<tr  height=50>");
document.write("<td width=30%>&nbsp;</td>");
document.write("<td align=center width=6% class=link onMouseover='link_on(this);' onMouseout='link_off(this)' onclick=window.location.href='default.htm'>Home</td>");
document.write("<td width=1 class=link>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</td>");
document.write("<td align=center width=6% class=link onMouseover='link_on(this);' onMouseout='link_off(this)' onclick=window.location.href='software.htm'>Software</td>");
document.write("<td width=1 class=link>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</td>");
document.write("<td align=center width=6% class=link onMouseover='link_on(this);' onMouseout='link_off(this)' onclick=window.location.href='consultancy.htm'>Consultancy</td>");
document.write("<td width=1 class=link>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</td>");
document.write("<td align=center width=6% class=link onMouseover='link_on(this);' onMouseout='link_off(this)' onclick=window.location.href='downloads.htm'>Downloads</td>");
document.write("<td width=1 class=link>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</td>");
document.write("<td align=center width=9% class=link onMouseover='link_on(this);' onMouseout='link_off(this)' onclick=window.location.href='contactus.htm'>Contact Us</td>");
document.write("<td width=30%>&nbsp;</td>");
document.write(" </tr>");
document.write(" </table>");
}

function clear_form()
{
var ctr; 
var NameLen=document.registration.your_name.value.length;
var JobLen=document.registration.job_title.value.length;
var CompLen=document.registration.company_name.value.length;
var  Add1Len=document.registration.address1.value.length;
var CityLen=document.registration.city.value.length;
var StateLen=document.registration.state.value.length;
var ZpcodeLen=document.registration.zpcode.value.length;
var CountryLen=document.registration.country.value.length;
var PhLen=document.registration.phone.value.length;
var EmailLen=document.registration.email.value.length;

if ((NameLen != 0) || (JobLen  != 0) || (CompLen != 0) || (Add1Len != 0)  ||  (CityLen != 0)  || (StateLen != 0) || (ZpcodeLen != 0) || (CountryLen != 0)  || (PhLen != 0) || (EmailLen != 0) )
   { ctr=1;}
 else
    { ctr=0;}
 if (ctr == 0) {
document.registration.your_name.value="";
document.registration.job_title.value="";
document.registration.company_name.value="";
document.registration.address1.value="";
document.registration.address2.value="";
document.registration.city.value="";
document.registration.state.value="";
document.registration.zpcode.value="";
document.registration.country.value="";
document.registration.phone.value="";
document.registration.fax.value="";
document.registration.email.value="";
document.registration.inquiry.value=""; }
}

function showconsult()
{ 
if ((ns4) || (ns6))
 { id="consult1"; }
else
 { id="consult"; }
show(id);
}

function hideconsult()
{ 
  if ((ns4) || (ns6))
   { id="consult1"; }
  else
   { id="consult"; }
 hide(id);
}

function showsoftware()
{ 
if ((ns4) || (ns6) )
 { id="sub_software1"; }
else
 { id="sub_software"; }
 
show(id);
}

function hidesoftware()
{ 
if ((ns4) || (ns6) )
 { id="sub_software1"; }
else
 { id="sub_software"; }
 
hide(id);
}
function show(id)
{
// Netscape 4
   if(ns4)
   {
   document.layers[id].visibility = "show";
   }
// Explorer 4
    if(ie4)
   {
    document.all[id].style.visibility = "visible";
   }
// W3C - Explorer 5+ and Netscape 6+
    if(ie5 || ns6)
   {
    document.getElementById(id).style.visibility = "visible";
    
   }
}

function hide(id)
{
// Netscape 4
   if(ns4)
   {
    document.layers[id].visibility = "hide";
   }
// Explorer 4
   if(ie4)
   {
    document.all[id].style.visibility = "hidden";
   }
// W3C - Explorer 5+ and Netscape 6+
   if(ie5 || ns6)
   {
    document.getElementById(id).style.visibility = "hidden";
   }
}

// end hiding contents -->