function translator(pattern) {
	var open_in_same_window = 1;
	var my_location = unescape(document.location.toString());
	var new_location ='';
	var new_pattern = '';
	if (my_location.indexOf('translate_c?') != -1) {
		/// From google...
		var indexof_u = my_location.indexOf('u=');
		if (indexof_u == -1) {
			new_location = document.location;
		}
		else {
			var subs = my_location.substring(indexof_u, my_location.length);
			var ss = subs.split('&');
			new_location = ss[0].substring(2, ss[0].length);
		}
	}
	else {
		new_location = document.location;
	}

	indexof_p = pattern.indexOf('|');

	var isen = '';
	if (indexof_p == -1) {
		indexof_p1 = pattern.indexOf('><');
		if (indexof_p1 == -1) {
			new_pattern = pattern;
			if (pattern == 'en') {
				isen = 1;
			}
		}
		else {
			var psplit =pattern.split('><');
			new_pattern = psplit[0]+'|'+psplit[1];
			if (psplit[1] == 'en') {
				isen = 1;
			}
		}
	}
	else {
		var psplit = pattern.split('|');
		new_pattern = psplit[0]+'|'+psplit[1];
		if (psplit[1] == 'en') {
			isen = 1;
		}
	}

	var thisurl = '';
	if (isen == 1) {
		thisurl = new_location;
	}
	else {
		thisurl = 'http://translate.google.com/translate_c?langpair=' + new_pattern + "&u=" + new_location;
	}

	if (open_in_same_window == 1) {
		window.location.href = thisurl;
	}
	else {
		if (CanAnimate ){
			msgWindow=window.open('' ,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
			msgWindow.focus();
			msgWindow.location.href = thisurl;
		}
		else {
			msgWindow=window.open(thisurl,'subwindow','toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,menubar=yes,resizable=yes,left=0,top=0');
		}
	}
}
function CheckAll(){
	var frm=document.activate;
	var count = frm.elements.length;
	for (i=0; i < count; i++){
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].checked == 0){
				frm.elements[i].checked = 1;
			} 
		}
	}
}

function UncheckAll(){
	var frm=document.activate;
	var count = frm.elements.length;
	for (i=0; i < count; i++){
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].checked == 1){
				frm.elements[i].checked = 0;
			}
		}
	}
}

function UncheckAll_product(){
	var frm=document.activate;
	var count = frm.elements.length;
	for (i=0; i < count; i++){
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].name == 'chk[]'){
				if(frm.elements[i].checked == 1){
					frm.elements[i].checked = 0;
				} 
			}
		}
	}
}

function chkdelete2(){
		var frm=document.activate;
		count = frm.elements.length;
		var c=0;
		
		for (i=0; i < count; i++){
			if(frm.elements[i].type=="checkbox"){
				if(frm.elements[i].checked == 1){
					c = 1;
				}
			}
		}
		if(c == 0){
			alert('First select a record to delete.');
			return false;
		}
		if(c!=0){
			 return confirm('Are you sure you want to delete ...');
		}
}
function chkdelete(){
		var frm=document.activate;
		count = frm.elements.length;
		var c=0;
		
		for (i=0; i < count; i++){
			if(frm.elements[i].type=="checkbox"){
				if(frm.elements[i].name == 'chk[]'){
					if(frm.elements[i].checked == 1){
						c = 1;
					}
			 }
			}
		}
		if(c == 0){
			alert('First select a record to delete.');
			return false;
		}
		if(c!=0){
			 return confirm('Are you sure you want to delete ...');
		}
}

function chksendmail(){
	var frm=document.activate;
	count = frm.elements.length;
	var c=0;
	for (i=0; i < count; i++){
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].checked == 1){
				c = 1;
			}
		}
		
	}
	if(c == 0){
		alert('First, select the record');
		return false;
	}
	else{
		if(frm.subject.value == ""){
				alert('Please enter subject.');
				frm.subject.focus();
				return false;
		}
		if(frm.message.value == ""){
				alert('Please enter your message.');
				frm.message.focus();
				return false;
		}
	}
}
function chkactivate(){
	var frm=document.activate;
	count = frm.elements.length;
	var c=0;
	for (i=0; i < count; i++){
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].checked == 1){
				c = 1;
			}
		}
	}
	if(c == 0){
		alert('First select a record to activate.');
		return false;
	}
}

function chkunactivate(){
	var frm=document.activate;
	count = frm.elements.length;
	var c=0;
	for (i=0; i < count; i++){
		if(frm.elements[i].type=="checkbox"){
			if(frm.elements[i].checked == 1){
				c = 1;
			}
		}
	}
	   if(c == 0){
		alert('First select a record to unactivate.');
		return false;
	}
}

function fnValidate(){
	var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
	var frm=document.enquiry;
	if(frm.ContactPerson.value==""){
		alert("Please Enter Your Name");
		frm.ContactPerson.focus();
		return false;
	}
	
	if(frm.eMail.value=="")	{
			alert("Please Enter Your Email-id");
			frm.eMail.focus();
			return false;
	}

	if (!re_mail.test(frm.eMail.value))	{
			alert( "Enter Your Email-id correctly" );
			frm.eMail.value="";
			frm.eMail.focus();
			return false;
	}
	if(frm.Country.value==""){
			alert("Please select your country");
			frm.Country.focus();
			return false;
	}
	if(frm.Phone.value==""){
			alert("Please Enter Your Phone");
			frm.Phone.focus();
			return false;
	}

	
}
function fnValidate_newsletter(){
	var doc=document.newsletter;
	if(doc.your_name.value=="" || doc.your_name.value==" ")
		{
		alert("Please Enter Your Name");
		doc.your_name.focus();
		return false;
		}
	if(doc.your_email.value.indexOf("@")== -1 || doc.your_email.value.indexOf(".")== -1){
		alert("Error in Your EmailID.\n");
		doc.your_email.focus();
		return false;
	}
						
}
function chkselect(val , val1){
	var count,c;
	var str=eval('document.'+val1);
	
	count=eval('document.'+val1+'.elements.length');
	c=0;
	for (i=0; i < count; i++){
		if(str.elements[i].name == 'chk[]'){
			if(str.elements[i].checked == 1){
				c = 1;
			}
		}
	}
	if(c == 0){
		alert(''+val);
		return false;
	}
}