
f7_droplayer=new Array()
f7_droplayer[0]="drop1"
f7_droplayer[1]="drop2"
f7_droplayer[2]="drop3"
f7_droplayer[3]="drop4"
f7_droplayer[4]="drop5"





//simple browser check
f7_v4=(parseInt(navigator.appVersion)>=4 && parseInt(navigator.appVersion)<=5)?1:0
f7_ie=(document.all && f7_v4)?1:0
f7_ns=(document.layers && f7_v4)?1:0


//code for drops

function f7_showdrop(thelayer){
	f7_keep=thelayer; f7_hideall(); f7_showitnow=1
	f7_showit(thelayer)
	}

function f7_showit(thelayer){
		if(f7_ie){ eval(f7_droplayer[thelayer]+'.style.visibility="visible"') }
		if(f7_ns){ eval('document.'+f7_droplayer[thelayer]+'.visibility="show"');}
	}


function f7_hidedrop(){
	f7_keep=-1; setTimeout('f7_hideall()',5)
	}

f7_keep=-1

function f7_hideall(){
	for(i=0;i<f7_droplayer.length;i++){  
		f7_hideit=0; f7_checkmousepos(i)
		if(f7_ie && f7_keep!=i){ 
			if(f7_hideit){ eval(f7_droplayer[i]+'.style.visibility="hidden"') } 
			}
		if(f7_ns && f7_keep!=i){ 
			if(f7_hideit){ eval('document.'+f7_droplayer[i]+'.visibility="hide"') }
			}
		}
	}

//deal with cursor over layer
document.onmousemove = f7_getmousepos
if (f7_ns) document.captureEvents(Event.MOUSEMOVE)

function f7_getmousepos(e){
	if(f7_ns){f7_mousex=e.pageX; f7_mousey=e.pageY}
	if(f7_ie){f7_mousex=event.clientX; f7_mousey=event.clientY;}
	}

function f7_checkmousepos(i){          
	if(f7_ns){     
		f7_x_min=eval('document.'+f7_droplayer[i]+'.left')
		f7_x_max=f7_x_min+eval('document.'+f7_droplayer[i]+'.clip.width')
		f7_y_min=eval('document.'+f7_droplayer[i]+'.top')
		f7_y_max=f7_y_min+eval('document.'+f7_droplayer[i]+'.clip.height')
		}    
	if(f7_ie){  
		
		f7_x_min=eval(f7_droplayer[i]+'.style.pixelLeft')
		//alert(f7_droplayer[i])   
		f7_x_max=f7_x_min+eval(f7_droplayer[i]+'.scrollWidth')
		f7_y_min=eval(f7_droplayer[i]+'.style.pixelTop')
		f7_y_max=f7_y_min+eval(f7_droplayer[i]+'.scrollHeight')
		}
	if (f7_mousex>=f7_x_min && f7_mousex<=f7_x_max && f7_mousey>=f7_y_min && f7_mousey<=f7_y_max){
		f7_hideit=0; setTimeout('f7_hideall()',5)
		}
	else { f7_hideit=1 }
	return f7_hideit
	}
	

ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
ns7 = (document.getElementById)? true:false;

function menuInit() {//alert('menu Init')
	if(ns4) {
		document.try2.captureEvents(Event.MOUSEDOWN);
		document.try2.onmouseover = hideall;
		document.try1.captureEvents(Event.MOUSEDOWN);
		document.try1.onmouseover = hideall;
	}
	else if(ie4) {
		try2.onmouseover=hideall;
		try1.onmouseover=hideall;
	}
	else {
		document.getElementById("try2").onmouseover=hideall;
		document.getElementById("try1").onmouseover=hideall;
	}
}

// Hide all layers
function hideall() {
	if(ns4) {
		document.try2.visibility="hidden";	
		document.try1.visibility="hidden";	
		document.drop1.visibility="hidden";	
		document.drop2.visibility="hidden";	
		document.drop3.visibility="hidden";	
		document.drop4.visibility="hidden";
        document.drop5.visibility="hidden";    
             	
                
    }
    else if(ie4){
		try2.style.visibility="hidden";		
		try1.style.visibility="hidden";		
		drop1.style.visibility="hidden";		
		drop2.style.visibility="hidden";		
		drop3.style.visibility="hidden";		
		drop4.style.visibility="hidden";	
        drop5.style.visibility="hidden";
                
	}
	else {
		document.getElementById("try2").style.visibility="hidden";
		document.getElementById("try1").style.visibility="hidden";
		document.getElementById("drop1").style.visibility="hidden";
		document.getElementById("drop2").style.visibility="hidden";
		document.getElementById("drop3").style.visibility="hidden";
		document.getElementById("drop4").style.visibility="hidden";
		document.getElementById("drop5").style.visibility="hidden";
	}

}


// onmouseover show each one.
function showdrop(x) {
	hideall();

	if(x==1) { 
		if(ie4) { try1.style.visibility="visible"; try2.style.visibility="visible"; drop1.style.visibility = "visible"; }
		if(ns4) { document.try1.visibility="show"; document.try2.visibility="show"; document.drop1.visibility = "show" }
		if(ns7) { document.getElementById("try1").style.visibility="visible"; document.getElementById("try2").style.visibility="visible"; document.getElementById("drop1").style.visibility = "visible"; }
	}
	if(x==2) { 
		if(ie4) { try1.style.visibility="visible"; try2.style.visibility="visible"; drop2.style.visibility = "visible"; }
		if(ns4) { document.try1.visibility="show"; document.try2.visibility="show"; document.drop2.visibility = "show" }
		if(ns7) { document.getElementById("try1").style.visibility="visible"; document.getElementById("try2").style.visibility="visible"; document.getElementById("drop2").style.visibility = "visible"; }
	}
	if(x==3) { 
		if(ie4) { try1.style.visibility="visible"; try2.style.visibility="visible"; drop3.style.visibility = "visible"; drop2.style.visibility = "visible"; }
		if(ns4) { document.try1.visibility="show"; document.try2.visibility="show"; document.drop3.visibility = "show"; document.drop2.visibility = "show"  }
		if(ns7) { document.getElementById("try1").style.visibility="visible"; document.getElementById("try2").style.visibility="visible"; document.getElementById("drop3").style.visibility = "visible"; document.getElementById("drop2").style.visibility = "visible";}
	}
	if(x==4) { 
		if(ie4) { try1.style.visibility="visible"; try2.style.visibility="visible"; drop4.style.visibility = "visible"; drop2.style.visibility = "visible";}
		if(ns4) { document.try1.visibility="show"; document.try2.visibility="show"; document.drop4.visibility = "show"; document.drop2.visibility = "show" }
		if(ns7) { document.getElementById("try1").style.visibility="visible"; document.getElementById("try2").style.visibility="visible"; document.getElementById("drop4").style.visibility = "visible"; document.getElementById("drop2").style.visibility = "visible";}
	}


        if(x==5) { 
		if(ie4) { try1.style.visibility="visible"; try2.style.visibility="visible"; drop5.style.visibility = "visible"; drop2.style.visibility = "visible";}
		if(ns4) { document.try1.visibility="show"; document.try2.visibility="show"; document.drop5.visibility = "show"; document.drop2.visibility = "show" }
		if(ns7) { document.getElementById("try1").style.visibility="visible"; document.getElementById("try2").style.visibility="visible"; document.getElementById("drop5").style.visibility = "visible"; document.getElementById("drop2").style.visibility = "visible";}
	}
   
 

}

/**
 * DHTML date validation script for dd/mm/yyyy. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : dd/mm/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}

function EmailCheck()
{
a = document.forms[0].email.value

myreg = /^\w+(\.\w+)*\@\w+(\.\w+){1,2}$/ ;

 
 myval = myreg.test(a);

if (myval == true)
{
return true 
}
else
{
return false
}
}


function PhoneCheck()
{
a = apply.phone.value
myreg = /[a-z ]/i ;
myspchar = /\W/
myval = myreg.test(a);
myval1 = myspchar.test(a);
if (myval == true  || a == "" || myval1 == true)
{
return false 
}
else
{
return true
}
}

function GradeCheck()
{
a = apply.grade.value
myreg = /[a-z ]/i ;
myspchar = /\W/
myval = myreg.test(a);
myval1 = myspchar.test(a);
if (myval == true  || a == "" || myval1 == true)
{
return false 
}
else
{
return true
}
}

function PercentCheck()
{
a = apply.percentage.value
myreg = /[a-z ]/i ;
myspchar = /\W/
myval = myreg.test(a);
myval1 = myspchar.test(a);
if (myval == true  || a == "" || myval1 == true)
{
return false 
}
else
{
return true
}
}

function SalaryCheck()
{
a = apply.currentnet.value
myreg = /[a-z ]/i ;
myspchar = /\W/
myval = myreg.test(a);
myval1 = myspchar.test(a);
if (myval == true  || a == "" || myval1 == true)
{
return false 
}
else
{
return true
}
}

function ExpsalCheck()
{
a = apply.expsalary.value
myreg = /[a-z ]/i ;
myspchar = /\W/
myval = myreg.test(a);
myval1 = myspchar.test(a);
if (myval == true  || a == "" || myval1 == true)
{
return false 
}
else
{
return true
}
}

function validatefromdt(){
	var dt=document.apply.fromdate
	if (isDate(dt.value)==false){
		dt.focus()
		return false
	}
    return true
 }
	function validatetodt(){
	var dt=document.apply.todate
	if (isDate(dt.value)==false){
		dt.focus()
		return false
	}
    return true
 }
	function validatedob(){
	var dt=document.apply.birthdate
	if (isDate(dt.value)==false){
		dt.focus()
		return false
	}
    return true
 }

