function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}
function resize_iframe(elem){
document.getElementById(elem).height=768 // requiredfor mozilla/firefox bugs, value can be "", null, or integer
var x=0;
x=window.frames[elem].document.body.scrollHeight;


//if(x > 1150)
//{
//	document.getElementById(elem).scrolling='yes';
//	document.getElementById(elem).height=768 ;
//}
//else
//{
	if(x < 450)
	{
		document.getElementById(elem).scrolling='no';
		document.getElementById(elem).height=450;
	}
	else
	{
		document.getElementById(elem).scrolling='no';
		document.getElementById(elem).height=window.frames[elem].document.body.scrollHeight;
	}
//}

}

function showhide2(elem)
{

	b = document.getElementById(elem);

	if(b.style.display == 'none' )
	{
		b.style.display = 'block';
	}
	else 
	{	
		b.style.display = 'none';
	}

}
function showhide3(elem)
{

	b = document.getElementById(elem);

	if(b.style.display == 'none' )
	{
		b.style.display = 'table';
	}
	else 
	{	
		b.style.display = 'none';
	}

}

function popwin(URL,t, w, h) { 
var popup_width = w
var popup_height = h
window.open(URL, t, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+popup_width+',height='+popup_height+'');
}
function popwin2(URL,t, w, h) { 
var popup_width = w
var popup_height = h
var t
eval("t = window.open(URL, t, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+popup_width+',height='+popup_height+',left = 520,top = 285,modal=yes');")}
function popwin3(URL,t, w, h) { 
var popup_width = w
var popup_height = h
day = new Date();
id = day.getTime();
eval("page" + t + " = window.open(URL,'" + t + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=320,height=240,left = 520,top = 285,modal=yes');");
}

function submitenter(myfield,e,frm)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   
   return false;
   }
else
   return true;
}
function autoTab(currentField, len, nextField)
{
		if (currentField.value.length < len)
			return;
		else
			nextField.focus()
}
function clrMsg(elem)
{
	elem.value == ""
}
function isalpha1 (ch)
{
	var h1 = ch.charCodeAt(0);
	 if((h1 > 64 && h1<91) || (h1 > 96 && h1<123) )
	 {
		 return true;
	 }
	 else
	 {
		 return false;
	 }
	
}
function postalcode(elem)
{	
		pcode = elem.value;
			if(pcode.length > 5 && pcode.length < 7 )
	{

		  if( isalpha(pcode.charAt(0)) && isalpha(pcode.charAt(2)) && isalpha(pcode.charAt(4)) && isnum(pcode.charAt(1)) && isnum(pcode.charAt(3)) && isnum(pcode.charAt(5)) )
		  {
			  elem.style.border='1px solid #009933';
			  return true;
		  }
		else	
		{
			elem.style.border='1px solid #FF0000';
			 return false;
		  }
	}
		  		else if ((pcode.length < 6 && pcode.length > 0) || pcode.length > 6)
	{
		
			elem.style.border='1px solid #FF0000';
			 return false;
	}
		  		else if (pcode.length == 0 )
	{
		
			
		elem.style.border='1px solid #7f9db9';
		return false;
	}

}
function isnum(elem)
{
	var numaric = elem;
	if(numaric != '')
	{
		var h1 = numaric.charCodeAt(0);
		 if(h1 > 47 && h1<58 )
		 {
			 return true;
		 }
		 else
		 {
			 return false;
		 }
	 }
	 else
	 {
		 return false;
	 }
}
function checkdate(elem)
{
	var a;
	a = elem.value;
	var temp;
	var flag;
	flag =0;
	if(a.length > 0)
	{
		for(var j=0; j<a.length; j++)
		{
			var alphaa = a.charAt(j);
			var h1 = alphaa.charCodeAt(0);
			 if((h1 > 47 && h1<58) || h1== 92 )
			 {
				 if(h1== 92)
				 {
					 flag ++;
				 }
				 if(flag > 2)
				 {
					 alphaa = null;
					 break;
				 }
			 }
			 else
			 {
				 alphaa = null;
				 break;
				 
			 }
			 temp.charAt() = a.charAt(j);
		}
	 }
	 else
	 {
		 return false;
	 }
}
function isDouble(elem)
{
	var numaric = elem.value;
	numaric = trimAll(numaric);
	var flag;
	flag =0;
	if(numaric.length > 0)
	{
		for(var j=0; j<numaric.length; j++)
		{
			var alphaa = numaric.charAt(j);
			var h1 = alphaa.charCodeAt(0);
			 if((h1 > 47 && h1<58) || h1== 46 )
			 {
				 if(h1== 46)
				 {
					 flag ++;
				 }
				 if(flag > 1)
				 {
					 elem.value='';
					 break;
				 }
			 }
			 else
			 {
				 elem.value='';
				 break;
				 
			 }
		}
	 }
	 else
	 {
		 return false;
	 }
	
}
function allowText(elem)
{
	var flag=0;
	var numaric = elem.value;
	numaric = trimAll(numaric);
	if(numaric.length > 0)
	{
		for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var h1 = alphaa.charCodeAt(0);
		  if( h1 != 34 || h1 != 39 )
		  {
			  
		  }
		  else	
		  {
			flag = 1;		
		  }
		}
	}
	if(flag ==1)
	{
		elem.value= '';
	}

}
function isalpha(elem)
{
	var numaric = elem;
	if(numaric != '')
	{
		  var hh = numaric.charCodeAt(0);
		  if( (hh > 64 && hh<91) || (hh > 96 && hh<123) )
		  {
			  
		  }
		else	
		{
			return false;
			
		  }
		
		
 		return true
	}
	else	
	{
	return false;
	
	}

}

function isalpha1 (elem)
{
	var numaric = elem.value;
	numaric = trimAll(numaric);
	if(numaric.length > 0)
	{
	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if( (hh > 64 && hh<91) || (hh > 96 && hh<123) ||  hh==32 )
		  {
			  
		  }
		else	
		{
			
			
			elem.style.border='1px solid #FF0000';
			return false;
			
		  }
		}
		
			
		elem.style.border='1px solid #009933';
 return true
	}
		else
	{
		
			
		elem.style.border='1px solid #7f9db9';
		return false;
	}
}
function isnum1 (elem)
{
	var numaric = elem.value;
	numaric = trimAll(numaric);
	if(numaric.length > 0)
	{
	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var h1 = alphaa.charCodeAt(0);
		  if((h1 > 47 && h1<58) ||  h1==47 ||  h1==32   )
		  {
			  
		  }
		else	
		{
			
			
			elem.style.border='1px solid #FF0000';
			return false;
			
		  }
		}
		
			
		elem.style.border='1px solid #009933';
 return true
	}

		else
	{
		
			
		elem.style.border='1px solid #7f9db9';
		return false;
	}
}
function alphanumeric(elem)
{
	var numaric = elem.value;
	numaric = trimAll(numaric);
		if(numaric.length > 0)
	{
	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123) ||  hh==47 ||  hh==32||  hh==92 ||  hh==46 || hh == 40 || hh==41)
		  {
			  
		  }
		else	
		{
			
			
			elem.style.border='1px solid #FF0000';
			return false;
		  }
		}
		
			
		elem.style.border='1px solid #009933';
  return true;
	}
		else
	{
		
			
		elem.style.border='1px solid #7f9db9';
		return false;
	}
}
function trimAll(sString) 
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}
function rightTrim(sString) 
{
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}

function leftTrim(sString) 
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
return sString;
}
function checkMailId(elem)
{
var arr = new Array('.com','.net','.org','.biz','.coop','.info','.museum','.name','.pro'
,'.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag','.ai','.al',
'.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw','.az','.ba','.bb',
'.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm','.bn','.bo','.br','.bs',
'.bt','.bv','.bw','.by','.bz','.ca','.cc','.cd','.cf','.cg','.ch','.ci',
'.ck','.cl','.cm','.cn','.co','.cr','.cu','.cv','.cx','.cy','.cz','.de',
'.dj','.dk','.dm','.do','.dz','.ec','.ee','.eg','.eh','.er','.es','.et',
'.fi','.fj','.fk','.fm','.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh',
'.gi','.gl','.gm','.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy',
'.hk','.hm','.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io',
'.iq','.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li','.lk',
'.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg','.mh','.mk',
'.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt','.mu','.mv','.mw',
'.mx','.my','.mz','.na','.nc','.ne','.nf','.ng','.ni','.nl','.no','.np',
'.nr','.nu','.nz','.om','.pa','.pe','.pf','.pg','.ph','.pk','.pl','.pm',
'.pn','.pr','.ps','.pt','.pw','.py','.qa','.re','.ro','.rw','.ru','.sa',
'.sb','.sc','.sd','.se','.sg','.sh','.si','.sj','.sk','.sl','.sm','.sn',
'.so','.sr','.st','.sv','.sy','.sz','.tc','.td','.tf','.tg','.th','.tj',
'.tk','.tm','.tn','.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug',
'.uk','.um','.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu',
'.ws','.wf','.ye','.yt','.yu','.za','.zm','.zw'); 
var mai = elem.value;
mai = trimAll(mai);
if(mai.length > 0)
{
var val = true;

var dot = mai.lastIndexOf(".");
var ext = mai.substring(dot,mai.length);
var at = mai.indexOf("@");
var dom = dot - at;
var sp = mai.indexOf(" ");

if(dom >= 4 && at >1 && sp == -1)
{
for(var i=0; i<arr.length; i++)
{
if(ext == arr[i])
{
val = true;
break;
} 
else
{
val = false;
}
}
if(val == false)
{
	
			
	elem.style.border='1px solid #FF0000';
return false;
}
}
else
{
	
	
	elem.style.border='1px solid #FF0000';
return false;
}


elem.style.border='1px solid #009933';
return true;
}
	else
	{
		
		
		elem.style.border='1px solid #7f9db9';
		return false;
	}
}
function isequal(elem, elem2)
{
	var a, b;
	a = elem2.value;
	b = elem.value;
	if(a != ''){
	if(b == a)
	{
		
		
		elem.style.border='1px solid #009933';	
		return true;
	}
	else
	{
		
		
		elem.style.border='1px solid #FF0000';
		return false;
	}
	}
	else
	{
		
		
		elem.style.border='1px solid #7f9db9';
		return false;
	}
}
function ispass(elem)
{
	var a= elem.value;
	if(elem.value != ''){
	if(a.length >5 && a.length < 17)
		{
			
			
			elem.style.border='1px solid #009933';
		return 	true;
	}
	else
	{
		
		
		elem.style.border='1px solid #FF0000';
		return false;
	}
	}
		else
	{
		
		
		elem.style.border='1px solid #7f9db9';
		return false;
	}

}

///////////////////////////////////////////////////////////
// "Live Clock Advanced" script - Version 1.0
// By Mark Plachetta (astroboy@zip.com.au)
//
// Get the latest version at:
// http://www.zip.com.au/~astroboy/liveclock/
//
// Based on the original script: "Upper Corner Live Clock"
// available at:
// - Dynamic Drive (http://www.dynamicdrive.com)
// - Website Abstraction (http://www.wsabstract.com)
// ========================================================
// CHANGES TO ORIGINAL SCRIPT:
// - Gave more flexibility in positioning of clock
// - Added date construct (Advanced version only)
// - User configurable
// ========================================================
// Both "Advanced" and "Lite" versions are available free
// of charge, see the website for more information on the
// two scripts.
///////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
/////////////// CONFIGURATION /////////////////////////////

	// Set the clock's font face:
	var myfont_face = "Verdana";

	// Set the clock's font size (in point):
	var myfont_size = "10";

	// Set the clock's font color:
	var myfont_color = "#000080";
	
	// Set the clock's background color:
	var myback_color = "#FFFFFF";

	// Set the text to display before the clock:
	var mypre_text = "";

	// Set the width of the clock (in pixels):
	var mywidth = 300;

	// Display the time in 24 or 12 hour time?
	// 0 = 24, 1 = 12
	var my12_hour = 0;

	// How often do you want the clock updated?
	// 0 = Never, 1 = Every Second, 2 = Every Minute
	// If you pick 0 or 2, the seconds will not be displayed
	var myupdate = 1;

	// Display the date?
	// 0 = No, 1 = Yes
	var DisplayDate = 1;

/////////////// END CONFIGURATION /////////////////////////
///////////////////////////////////////////////////////////

// Browser detect code
        var ie4=document.all
        var ns4=document.layers
        var ns6=document.getElementById&&!document.all

// Global varibale definitions:

	var dn = "";
	var mn = "th";
	var old = "";

// The following arrays contain data which is used in the clock's
// date function. Feel free to change values for Days and Months
// if needed (if you wanted abbreviated names for example).
	var DaysOfWeek = new Array(7);
		DaysOfWeek[0] = "Sunday";
		DaysOfWeek[1] = "Monday";
		DaysOfWeek[2] = "Tuesday";
		DaysOfWeek[3] = "Wednesday";
		DaysOfWeek[4] = "Thursday";
		DaysOfWeek[5] = "Friday";
		DaysOfWeek[6] = "Saturday";

	var MonthsOfYear = new Array(12);
		MonthsOfYear[0] = "January";
		MonthsOfYear[1] = "February";
		MonthsOfYear[2] = "March";
		MonthsOfYear[3] = "April";
		MonthsOfYear[4] = "May";
		MonthsOfYear[5] = "June";
		MonthsOfYear[6] = "July";
		MonthsOfYear[7] = "August";
		MonthsOfYear[8] = "September";
		MonthsOfYear[9] = "October";
		MonthsOfYear[10] = "November";
		MonthsOfYear[11] = "December";

// This array controls how often the clock is updated,
// based on your selection in the configuration.
	var ClockUpdate = new Array(3);
		ClockUpdate[0] = 0;
		ClockUpdate[1] = 1000;
		ClockUpdate[2] = 60000;

// For Version 4+ browsers, write the appropriate HTML to the
// page for the clock, otherwise, attempt to write a static
// date to the page.
	if (ie4||ns6) { document.write('<ilayer bgColor="'+myback_color+'" id="ClockPosNS" visibility="hide"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
	else if (document.layers) { document.write('<ilayer bgColor="'+myback_color+'" id="ClockPosNS" visibility="hide"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); }
	else { old = "true"; show_clock(); }

// The main part of the script:
	function show_clock() {
		if (old == "die") { return; }
	
	//show clock in NS 4
		if (ns4)
                document.ClockPosNS.visibility="show"
	// Get all our date variables:
		var Digital = new Date();
		var day = Digital.getDay();
		var mday = Digital.getDate();
		var month = Digital.getMonth();
		var hours = Digital.getHours();


		var minutes = Digital.getMinutes();
		var seconds = Digital.getSeconds();

	// Fix the "mn" variable if needed:
		if (mday == 1) { mn = "st"; }
		else if (mday == 2) { mn = "nd"; }
		else if (mday == 3) { mn = "rd"; }
		else if (mday == 21) { mn = "st"; }
		else if (mday == 22) { mn = "nd"; }
		else if (mday == 23) { mn = "rd"; }
		else if (mday == 31) { mn = "st"; }

	// Set up the hours for either 24 or 12 hour display:
		if (my12_hour) {
			dn = "AM";
			if (hours > 12) { dn = "PM"; hours = hours - 12; }
			if (hours == 0) { hours = 12; }
		} else {
			dn = "";
		}
		if (minutes <= 9) { minutes = "0"+minutes; }
		if (seconds <= 9) { seconds = "0"+seconds; }

	// This is the actual HTML of the clock. If you're going to play around
	// with this, be careful to keep all your quotations in tact.
		myclock = '';
		myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">';
		myclock += mypre_text;
		myclock += hours+':'+minutes;
		if ((myupdate < 2) || (myupdate == 0)) { myclock += ':'+seconds; }
		myclock += ' '+dn;
		if (DisplayDate) { myclock += ' on '+DaysOfWeek[day]+', '+mday+mn+' '+MonthsOfYear[month]; }
		myclock += '</font>';

		if (old == "true") {
			document.write(myclock);
			old = "die";
			return;
		}

	// Write the clock to the layer:
		if (ns4) {
			clockpos = document.ClockPosNS;
			liveclock = clockpos.document.LiveClockNS;
			liveclock.document.write(myclock);
			liveclock.document.close();
		} else if (ie4) {
			clock.innerHTML = myclock;
		} else if (ns6){
			document.getElementById("clock").innerHTML = myclock;
                }            

	if (myupdate != 0) { setTimeout("show_clock()",ClockUpdate[myupdate]); }
}


