// JavaScript Document
function getDivByID(layerID) {
	if (document.getElementById) {
		// this is the way the standards work
		return document.getElementById(layerID);
	} else if (document.all) {
		// this is the way old msie versions work
		return document.all[layerID];
	} else if (document.layers){
		// this is the way nn4 works
		return document.layers[layerID];
	}
	return null;
}
//Trim Functions
	function ltrim(str) { 
		for(var k = 0; k < str.length && isWhitespace(str.charAt(k)); k++);
		return str.substring(k, str.length);
	}
	function rtrim(str) {
		for(var j=str.length-1; j>=0 && isWhitespace(str.charAt(j)) ; j--) ;
		return str.substring(0,j+1);
	}
	function trim(str) {
		return ltrim(rtrim(str));
	}
	function isAlphaNumeric(val){
		if (val.match(/^[a-zA-Z0-9]+$/))
		{
		return true;
		}
		else
		{
		return false;
		} 
	}
	function isValidUserName(val){
		if (val.match(/^[a-zA-Z0-9_]+$/)){
			if(val.match(/^[_]+$/)){
				return false;
			}else{
				return true;
			}
		}else{
			return false;
		}
	}
	function isWhitespace(charToCheck) {
		var whitespaceChars = " \t\n\r\f";
		return (whitespaceChars.indexOf(charToCheck) != -1);
	}
//End Trim Functions
//Email Validation
	function isValidEmail(email){
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(email)){
			return true;
		}else{
			return false;
		}
		
	}
//Get Count Selected Values In Multi Select Combo 
function countOfMultiSelect(comboName,count){
	var objCombo=comboName;
    var selCount=0;
    for (var i=0; i<objCombo.options.length; i++)
  	 	selCount += (objCombo.options[i].selected)?1:0;
    if (selCount > count){
	  	return false;
    }else{
    	return true;
    }
}
//Function To Count Characters Dynamically
function countChar(field,length,divName){
	//alert(field);
	var len,val,msg;
	if (field.value == '') return;
	msg = field.value;
	len = msg.length;
	if(len > length){
		len = length;
		val = field.value;
		val = val.replace(/\r\n/g,"\n");
            	field.value = val.substring(0,length);
		val = val.replace(/\n/g,"\r\n");
	}
	//var leng = length-len;
	divName.innerHTML = "Count : "+len;
	return true;
}
//Html Editor
function __fncOpenHtmlEditor(strOwner, strValue){
	var newWin = window.open("./../htmlEditor.php?owner="+strOwner+"&value="+strValue, "", "ststusbar=1,menubar=0,height=600,width=1000,scrollbars=1");
	newWin.focus();
}
function __fncgenarateDay(sel){
	var month = thisForm.dobMonth.value; 
	var year = thisForm.dobYear.value; 
	if(month==0 || year==0){
		return;
	}
	var leap = (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
	if (month==4 || month==6 || month==9 || month==11) {
		var days = 30;
	}else if (month==2) {
		var days = leap;
	}else{
		var days = 31;
	}
	thisForm.dobDay.options.length = days;
	for (var i = 1; i <= days; i++) {
		thisForm.dobDay.options[i]=new Option(i,i);
		if(i==sel){
			document.getElementById('dobDay').options[i].selected=true;
		}
   	}
}
function __fncspacebtnnumbers(){
	var test;
		var str=thisForm.txtNum.value;
		var test=str.split(" ");
		for(var i=0;i<((test.length)-1);i++){
			if (test!= '') {
				alert('check');
				return false;
			}	
		}	
}




