// JavaScript Document

function viewFotos(img, name, w, h){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
features = "toolbar=no,location=no,directories=no,status=no,menubar=no," +"scrollbars=no,resizable=yes,width="+w+",height="+h+",left="+winl +",top="+wint;

 dlg = window.open ("","Details",features);
 dlg.document.write("<html><head><title>" + name + " Zoom</title></head>");
 dlg.document.write ("<body bgcolor=white><center>");
 dlg.document.write("<table width=100% height=100%>");
 dlg.document.write("<tr><td align=center valign=middle>");
 dlg.document.write ("<font size=2 font color=black face=verdana>" + name + "</font><br><font size=1 font color=black face=verdana>(click image to close window)</font></a><br><br>");
 dlg.document.write("<a href=# onClick=window.close();>");
 dlg.document.write("<img src=" + img + " border=\"0\">");
 dlg.document.write("</td></tr>");
 dlg.document.write("<tr><td align=center valign=middle>");
 dlg.document.write("<a href=# onClick=window.close();>");
 dlg.document.write("<font size=1 font color=black face=verdana>(close window)</font></a>");
 dlg.document.write("</td></tr>");
 dlg.document.write("</table></body></html>");
 dlg.document.close();
}



function show_tab(t)
{
	
	//alert (t);
	curr_tab = document.getElementById('tab' + t);
	
	var tobj=document.getElementById("tabs")
	tobj_lis=tobj.getElementsByTagName("li")
	//alert (tobj_lis.length);	
	
	for(i=1; i<=5; i++)
	{
		document.getElementById('tab' + i).className = "hide-tab";
		tobj_lis[i-1].className="";
	}
	
	curr_tab.className="show-tab";
	tobj_lis[t-1].className="current";
}

function addBookmark(title,url) {
if (window.sidebar) { 
window.sidebar.addPanel(title, url,""); 
} else if( document.all ) {
window.external.AddFavorite(url, title);
} else if( window.opera && window.print ) {
return true;
}
}

function CheckInput(objName)
{
 var field = objName;
 var invalid = "~'%";
 for (var i=0; i < field.value.length; i++) 
 {
   temp = "" + field.value.substring(i, i+1);
   if (invalid.indexOf(temp) != "-1") 
   {
      alert("Input contains illegal character: " + temp );
      field.value = "";
      field.focus();
      return false;
   }
 }
 return true;
} 



/* ================ Drop Down Menu ======================= */

var menuwidth='150px' //default menu width
var menubgcolor='#F6F6F6'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)

dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu


/* ======================= End Drop Down Menu ==================== */

/* ======================= Call Back Form Validation ==================== */
function validate(frm)
{
 name = frm.name;
 email = frm.email;
 phone = frm.phone;
 subject = frm.subject;


 err_flag = 0;
 
 if (name.value == "" || !removeSpaces(name.value))
  {
   alert ("Please enter proper Name!");
   name.focus();
   name.value="";
   return false; 
  }else if (phone.value == "" || !removeSpaces(phone.value))
    {
     alert ("Please enter proper Telephone Number!");
     phone.focus();
     phone.value="";
     return false; 
   }else if (email.value == "" || !validate_email(email.value))
   {
   alert ("Please enter proper Email!");
   email.focus();
   return false; 
  }
 
  else if (subject.value == "" || !removeSpaces(subject.value))
    {
     alert ("Please enter proper Message!");
     subject.focus();
     subject.value="";
     return false; 
    }
  

}

function validate_email(e)
{
 var str=e;
 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

 if (!filter.test(str))
  return false;
 else
  return true;
}

function removeSpaces(string) {
 var tstring = "";
 string = '' + string;
 splitstring = string.split(" ");
 for(i = 0; i < splitstring.length; i++)
 tstring += splitstring[i];
 return tstring;
}

/* ==================== End Call Back Form Validation ==================== */

/*================Dropdown Menu================*/
/*
startMenu = function()
{
	navRoot = document.getElementById("navigation").childNodes[0];

	if (document.all && document.getElementById)
	{
		navRoot = document.getElementById("navigation").childNodes[0];
		for (i=0; i<navRoot.childNodes.length; i++)
		{
			node = navRoot.childNodes[i];
			//alert (node.nodeName);
			if (node.nodeName=="LI")
			{
				node.onmouseover=function() {this.className+="over";}
				node.onmouseout=function() {this.className=this.className.replace("over", "");}
			}
		}
	}
	
}
window.onload=startMenu;
*/
/* 10-02-09 IndianNIC*/

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;
function menuOpen(id)
{	
	mcancelclosetime();
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
}
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
document.onclick = mclose;
/*================End == Dropdown Menu================*/
