function goImgWin(myImage,myWidth,myHeight,origLeft,origTop) {
myHeight += 24;
myWidth += 24;
TheImgWin = window.open(myImage,'image','height=' +
myHeight + ',width=' + myWidth +
',toolbar=no,directories=no,status=no,' +
'menubar=no,scrollbars=no,resizable=yes');
TheImgWin.resizeTo(myWidth+2,myHeight+30);
//TheImgWin.moveTo(origLeft,origTop);
TheImgWin.focus();
}

function isValidURL(cntrl){ 
	var url=cntrl.value;
	var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/; 
    if(RegExp.test(url)){ 
        return true; 
    }else{ 
        alert("Invalid URL");
		cntrl.value = "";
		cntrl.focus();
		return false; 
    } 
} 




function CheckPasswordLength(cntrl,str)
{
	if (cntrl.value.length < 6)
	{
		alert("Invalid Username or Password!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function CheckCapitalLetterPassword(cntrl,str)
{
	var string=cntrl.value;
		
		for(var i=0;i < cntrl.value.length; i++)
		{
		  
		  if((string.charCodeAt(i) > 64 ) && (string.charCodeAt(i)  < 91))
		  { 
				return true;
		  }
		}
	
alert("Invalid Username or Password!");
return false;
}


function CheckSmallLetterPassword(cntrl,str)
{
	var string=cntrl.value;
		
		for(var i=0;i<cntrl.value.length;i++)
		{
		  if( (string.charCodeAt(i) > 96) &&  (string.charCodeAt(i) < 123)  )
		  { 
				return true;
		  }
		}
	
alert("Invalid Username or Password!");
return false;
}





function CheckEmail(email)
{
	 if(!RegExp(/^\w[\w\-\.]+\@\w[\w\-]+(\.\w[\w\-]+)+$/).test(email.value))
	 {
		alert("Please enter valid email address!");
		email.focus();
		return false;
	 }
	 else 
		return true; 
}
function CheckSelect(cntrl)
{
	if (cntrl.value == 0)
	{
		alert("Please select one option");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}

}
function CheckEmpty(cntrl, strMsg)
{
	if (cntrl.value == "")
	{
		alert("Please enter " + strMsg + "!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}

/*
function CheckString(cntrl)
{
	if(!RegExp("[a-zA-Z][\w\ ]*[a-zA-Z]+$").test(cntrl.value))
	{
		alert("Please enter alphabets only!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}
*/

function CheckString(cntrl)
{
	var ch;
	ch = cntrl.value.search("[^A-Za-z' ]");
	if(cntrl.value.length > 0 &&  ch>= 0) 
	{
		alert("Please enter alphabets only!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}
function CheckPhone(cntrl)
{
	if(!RegExp(/^[0-9][\d\- ]*[0-9]$/).test(cntrl.value))
	{
		alert("Phone number does not appear to be valid. Please check!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function CheckAlphaNumerals(cntrl)
{
	if(!RegExp(/^[a-zA-Z][\w\d\ \.,-]*[a-zA-Z0-9]$/).test(cntrl.value))
	{
		alert("Please enter alphanumerals only!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function CheckPassLength(cntrl)
{
	if (cntrl.value.length < 4)
	{
		alert("Password should have at least four characters. Please check!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function CheckEmail(cntrl)
{
	if(!RegExp(/^[A-Za-z][\w\-\.]+\@\w[\w\-]+(\.\w[\w\-]+)+$/).test(cntrl.value))
	{
		alert("This Email ID does not appear to be valid. Please check!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function ConfirmPassword(cntrl1, cntrl2)
{
	if(cntrl1.value != cntrl2.value)
	{
		alert("Password doesn't match with confirmation password. Please check!");
		cntrl2.focus();
		return false;
	}
	else 
	{
		return true;
	}
}

function CheckLength(cntrl,strCntrlName,len)
{
	if (cntrl.value.length < 0)
	{
		alert(strCntrlName+" should have at least one characters. Please check!");
		cntrl.focus();
		return false;
	}
	else if (cntrl.value.length > len)
	{
		alert(strCntrlName+" should have less than "+len+" characters. Please check!");
		cntrl.focus();
		return false;
	}
	
	else
	{
		return true;
	}
}

function CheckDate(d,m,y)
{
	var toDay = new Date();
	var monthfield=m
	var dayfield=d
	var yearfield=y
	var dayobj = new Date(yearfield, monthfield-1, dayfield)
	if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))
	{
		alert("Invalid Day, Month, or Year range detected. Please correct and submit again.");
		return false;
	}	
	if(dayobj>toDay)
	{
		alert("You cannot enter future date");
		return false;
	}
	else 
	{
		return true;
	}
}
function linkclick(action,page,type,type1)
{
	document.parameters.action=action;
	document.parameters.includeFile.value=page;
	document.parameters.type.value=type;
	document.parameters.lefttype.value=type1;
	document.parameters.submit();
}
function htmlValidate(formTag)
{
	str=formTag.value;
	if(str.match(/([\<\?php])([^\>]{1,})*([\>\?>])/i)==null){
		return true;
	}
	else{
	 alert("Html Tags Are Not Allowed");
	 formTag.value='';
	 return false;
 	}
}
