// JavaScript Document
function jumpto(target){
	return window.location.href=target;
}
function setbg(obj,color){
return obj.bgColor=color;
}
function alphabetsOnly(element_value){	
if(element_value.search(/[^a-zA-Z]/) == -1){	
	return true;
}else
	return false;
}
function spcalphabetsOnly(element_value){	
if(element_value.search(/[^a-zA-Z ]/) == -1){	
	return true;
}else
	return false;
}
function numbersOnly(element_value){	
if(element_value.search(/[^0-9]/) == -1){	
	return true;
}else
	return false;
}
function strokeAlphabets(){
if((window.event.keyCode<65 || window.event.keyCode>97) && (window.event.keyCode<97 || window.event.keyCode>122)){
window.event.cancelBubble=true;
window.event.returnValue=false;
}
}
function strokeNumbers(){
if(window.event.keyCode<48 || window.event.keyCode>57){
window.event.cancelBubble=true;
window.event.returnValue=false;
}
}
function strokeDecimalNumbers(){
if((window.event.keyCode<48 || window.event.keyCode>57) &&  window.event.keyCode!=46){
window.event.cancelBubble=true;
window.event.returnValue=false;
}
}
function testRegExp(form_name, element_name, re) {
	return new RegExp(re).test(document.forms[form_name].elements[element_name].value);
}
function validateEmail(form_name, element_name) {
	return testRegExp(form_name, element_name, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
}
function validateSelection(form_name, element_name) {
	return (document.forms[form_name].elements[element_name].selectedIndex > 0);
}
function validateCheckBox(form_name, element_name) {
	return document.forms[form_name].elements[element_name].checked;
}
function validateAbsUrl(form_name, element_name) {
	return testRegExp(form_name, element_name, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+$');
}

function validateNumber(form_name, element_name, allow_blank) {
	return (!allow_blank && value == '') ? false : testRegExp(form_name, element_name, '^-?[0-9]*\\.?[0-9]*$');
}

function textTooltip(obj,txt)
{
//-------------------------------------Several Attribute Configurations-------------------//
obj.T_ABOVE = true;
//obj.T_LEFT = true; 
obj.T_BGCOLOR='#cccccc'; 
obj.T_BGIMG=''; 
obj.T_BORDERWIDTH=1; 
obj.T_BORDERCOLOR='#336699';
obj.T_DELAY=1000; 
//obj.T_FIX = [200, 400];
obj.T_FONTCOLOR='#993399';
obj.T_FONTFACE='verdana,geneva,sans-serif';
//obj.T_FONTSIZE='30px'; 
//obj.T_FONTWEIGHT='bold';

obj.T_OFFSETX=32; 
//obj.T_OFFSETY=32;
obj.T_OPACITY=80; 
obj.T_PADDING=5;
obj.T_SHADOWCOLOR='#cccccc';
obj.T_SHADOWWIDTH=4; 
obj.T_STATIC=true;
//obj.T_STICKY=true;
//obj.T_TEMP=3500; 
//obj.T_TEXTALIGN='right';
obj.T_TITLE='Some title';
obj.T_TITLECOLOR='#ff6666'; 
obj.T_WIDTH=200;
//------------------------------------- Attribute Configurations Ends---------------------//

var text=txt;
return text;
}

function imageTooltip(obj,img,title)
{
//-------------------------------------Several Attribute Configurations-------------------//
obj.T_ABOVE = true;
//obj.T_LEFT = true; 
obj.T_BGCOLOR='#cccccc'; 
obj.T_BGIMG=''; 
obj.T_BORDERWIDTH=1; 
obj.T_BORDERCOLOR='#336699';
obj.T_DELAY=0; 
//obj.T_FIX = [200, 400];
obj.T_FONTCOLOR='#993399';
obj.T_FONTFACE='verdana,geneva,sans-serif';
//obj.T_FONTSIZE='30px'; 
//obj.T_FONTWEIGHT='bold';

obj.T_OFFSETX=32; 
//obj.T_OFFSETY=32;
obj.T_OPACITY=80; 
obj.T_PADDING=5;
obj.T_SHADOWCOLOR='#cccccc';
obj.T_SHADOWWIDTH=4; 
obj.T_STATIC=true;
//obj.T_STICKY=true;
//obj.T_TEMP=3500; 
//obj.T_TEXTALIGN='right';
if(title!=''){
obj.T_TITLE='Some title';
obj.T_TITLECOLOR='#ff6666'; 
}
obj.T_WIDTH=250;
//------------------------------------- Attribute Configurations Ends---------------------//

var image="<div align=\'center\'><img src=\'"+ img +"\' width=\'200\' height=\'200\'> </div>";
return image;
}
function popup(page_name,width,height){
	var ah=screen.availHeight-30;
	var aw=screen.availWidth-10;
	var xc=(aw-width)/2;
	var yc=(ah-height)/2;
	window.open(page_name,"prev_profile","width="+width+",height="+height+",left="+xc+",top="+yc+",location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,dependent=yes,directories=no,titlebar=no");
}
function check_valid_chars(charset,value){
for (var i = 0;i < value.length;i++){
	temp = value.substring(i,i+1)
	if (charset.indexOf(temp)==-1){
		return false;
	}
}
return true;
}

function count_words(element_value,word_length)
{	
	var words=0;;
	element_value=element_value.split(" ");
	words=element_value.length;
	if(parseInt(words,10)>=parseInt(word_length,10)){return true;}
	else { return false;}

}
