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 CheckVideo(name,msg)
{
	
	
	var r=name.value.split(".");
	if(r[1]=='FLV' || r[1]=='flv')
	{
	  	return true;
	}
	else
	{
	  alert("Upload only FLV  extention video")	;
	  return false;
	}
}



function CheckCatname(ctname,name)
{

  var t= ctname.value;
   for(var i=0;i<t.length;i++)
  {
	  
 if(t.charAt(i)== '/' || t.charAt(i)== '*' || t.charAt(i)== '?' || t.charAt(i)== '<' || t.charAt(i)== '>' || t.charAt(i)== '|' || 																									 t.charAt(i)== ':' || t.charAt(i)== '"' || t.charAt(i)== '$' || t.charAt(i)== '^' || t.charAt(i)== '%' || t.charAt(i)== '@' || t.charAt(i)== '#' || t.charAt(i)== '!' || t.charAt(i)== '(' || t.charAt(i)== '$' || t.charAt(i)== '@' || t.charAt(i)== '!' || t.charAt(i)== '^' || t.charAt(i)== '+' || t.charAt(i)== ','  || t.charAt(i)== '{' || t.charAt(i)== '}' || t.charAt(i)== '[' || t.charAt(i)== ']' || t.charAt(i)== ';')
   {
		alert(name+" name can not contain the  Special character.");  
		
		return false;
   }
  
  }
  return true;
 }






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 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 == "" || cntrl.value == null)
	{
		alert("Please enter " + strMsg + "!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}
function CheckCategory(cntrl, strMsg)
{
	if (cntrl.value == "")
	{
		alert("Please Select " + 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("Product Prize does not appear to be valid. Please check!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}


function CheckPhone1(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 CheckNumber(cntrl)
{
	if(!RegExp(/^[0-9][\d\- ]*[0-9]$/).test(cntrl.value))
	{
		alert("Product Price is not valid. Please check!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}

function CheckNumber1(cntrl)
{
	if(!RegExp(/^[0-9][\d\- ]*[0-9]$/).test(cntrl.value))
	{
		alert("Product Quantity is not valid. Please check!");
		cntrl.focus();
		return false;
	}
	else
	{
		return true;
	}
}
function CheckNumber2(cntrl)
{
	if(!RegExp(/^[0-9][\d\- ]*[0-9]$/).test(cntrl.value))
	{
		alert("Product Rate is not 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();
}