



function translator(pattern)
{
	var thisurl = 'http://translate.google.com/translate_c?langpair=' + pattern + "&u=" + document.location;
	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 mail(){
	document.location="mailto:travel.webmaster@indiamart.com?subject="+document.location;
}

function openchild_nl(thisurl) 
{
	var windowTop;
	var windowLeft;
	windowTop=(screen.height*(20/100))*0.7;
	windowLeft=screen.width*(19/100);

	var email_val = document.theForm.email.value;
	var from_site_val = document.theForm.from_site.value;
	var is_window_val = document.theForm.is_window.value;
	var org_referer = document.location;
	var thisurl_string = thisurl + "?email=" + email_val + "&from_site=" + from_site_val + "&is_window=" + is_window_val + "&org_referer=" + org_referer;

	if ( CanAnimate ) {
			msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=570,height=260,top='+windowTop+',left='+windowLeft);
			msgWindow.focus();
			msgWindow.location.href = thisurl_string;
	}
	else {
			msgWindow=window.open( thisurl_string,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=570,height=260,top='+windowTop+',left='+windowLeft);
	}
}



function validate_nl(theForm)
{
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		theForm.email.focus();
		return (false);
	}
}


function getblank_nl(this1)  {
	this1.value = "";
    return true;	
}

function checkSearchTop()
{

	if (document.SearchTop.search.value.length < 3){
	    alert("Enter at least three characters for search."); 
	    document.SearchTop.search.focus();
	    return false;
	}
	return true;
}

function checkSearchBottom()
{

	if (document.SearchBottom.search.value.length < 3){
	    alert("Enter at least three characters for search."); 
	    document.SearchBottom.search.focus();
	    return false;
	}
	return true;
}

function openchild_email_this_page(thisurl){
	if ( CanAnimate ){
        msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height=260');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
	}
	else {
        msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=635,height=260');
	}
}


function check_form_email_this_page(form1)
{
	if (form1.S_name.value.length == 0){
		alert("Kindly enter your name."); 
		form1.S_name.focus();
		return false;
	}
    S_email_val = checkform_email(form1.S_email,"Kindly enter your Email address.");
	if(!S_email_val) {
		return false;
	}

	R_email1_val = checkform_email(form1.R_email1,"Kindly enter the Email ID of your friend / associate.");
	if(!R_email1_val) {
		return false;
	}

	if(form1.R_email2.value.length != 0)
	{
		R_email2_val = checkform_email(form1.R_email2,"Kindly enter the Email ID of your friend / associate.");
		if(!R_email2_val) {
			return false;
		}
	}

    if(form1.R_email3.value.length != 0)  
    {
        R_email3_val = checkform_email(form1.R_email3,"Kindly enter the Email ID of your friend / associate.");
        if(!R_email3_val) {
            return false;
        }
    }

    if(form1.R_email4.value.length != 0)  
    {
        R_email4_val = checkform_email(form1.R_email4,"Kindly enter the Email ID of your friend / associate.");
        if(!R_email4_val) {
            return false;
        }
    }

	//if (form1.message.value.length == 0){
	//	alert("Please write a message to your friend / associate."); 
	//	form1.message.focus();
	//	return false;
	//}

	else {
		return true;
	}	
}

function checkform_email(EMAIL,CMESSAGE)
{
    if (EMAIL.value.length == 0){
        alert(CMESSAGE); 
	    EMAIL.focus();
    	return false;
	}

	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(EMAIL.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		EMAIL.focus();
		return (false);
	}

	else
	{ 
        return true;
	}	
}

//function addbookmark()
//{
//bookmarkurl="http://wwwJavascriptsource.com"
//bookmarktitle="Welcome To The Java Script Source"
//if (document.all)
//window.external.AddFavorite(bookmarkurl,bookmarktitle)
//}

function openchild_commercial(thisurl){
	if ( CanAnimate ){ 
        msgWindow=window.open( '' ,'subwindow');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
	}
	else {
        msgWindow=window.open( thisurl,'subwindow');
	}       
}

function openchild_weather(cityid){
	var thisurl = "/includes/weather-average.cgi?i=" + cityid + "&t=c";
	if (CanAnimate ){ 
        msgWindow=window.open('','subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=400,height=450');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
	}
	else {
        msgWindow=window.open(thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,menubar=no,resizable=yes,width=400,height=450');
	}       
}

function code_for_bookmark()	{
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		var url=document.location;
		var title = document.title;
		document.write('<A HREF="javascript:window.external.AddFavorite(url,title);" onMouseOver="window.status=\'Bookmark this page!\';return true;" onMouseOut="window.status=\'\';return true;"><IMG SRC=/includes/gifs/bookmark-this-page.gif ALT="Bookmark this page" WIDTH=15 HEIGHT=15 BORDER=0 HSPACE=3 VSPACE=0><FONT class="navsmall"><B>Bookmark this page</B></FONT></a>');
	}
	else {
		var msg = '<IMG SRC=/includes/gifs/bookmark-this-page.gif ALT="Bookmark this page" WIDTH=15 HEIGHT=15 BORDER=0 HSPACE=3 VSPACE=0><FONT class="navsmall"><B>Bookmark ';
		if (navigator.appName == "Netscape") {
			msg += "  (CTRL-D)</B></FONT>";
			document.write(msg);
		}
	}
}

function mail(){
	document.location="mailto:travel.webmaster@indiamart.com?subject="+document.location;
}



function checkMe(frm){
var hn="";
		if ( frm.txiName.value.length <= 0 ){
			alert("Name is missing!");
			frm.txiName.focus();
			return false;
		}
		if ( frm.txiEmail.value.length <= 0 ){
			alert("Email is missing!");
			frm.txiEmail.focus();
			return false;
		}

		
		if (frm.selHotelNameM.value != "NA"){
			
			for (var j=0;j<frm.selHotelNameM.length; j++ ){
				if (frm.selHotelNameM[j].selected){
					hn = hn + frm.selHotelNameM[j].value + ", ";
				}

			}
	
			frm.txiHotelName.value = frm.txiHotelName.value + hn;
			//alert(frm.txiHotelName.value);
		
		}else{
			//alert("Please Select One or More Hotel(s) Name for Query/Information required.");
			//frm.selHotelNameM.focus();
			//return false;	
		}


return true;
}



function checkPayment(frm){
		var emsg ="";
		if ( frm.txiPinNumber.value.length < 16 || frm.txiPinNumber.value.length > 16){
				emsg += "Please fill in your PIN no. provided by Indian Holiday Pvt. Ltd. CORRECTLY!\n";
				frm.txiPinNumber.value ="";
				frm.txiPinNumber.focus();
		}else if ( checkforalphanumeric(frm.txiPinNumber.value.toUpperCase()) == -1 ){
				emsg += "Please fill your 16 digit PIN no. correctly as provided by Indian Holiday Pvt. Ltd.\n";
				frm.txiPinNumber.value ="";
				frm.txiPinNumber.focus();
		}
		
		if( frm.txiPinNumber.value.charAt(0).toUpperCase() != "H" || frm.txiPinNumber.value.charAt(1).toUpperCase() != "M" || checkforalpha(frm.txiPinNumber.value.charAt(2).toUpperCase()) == -1 || checkforalpha(frm.txiPinNumber.value.charAt(3).toUpperCase()) == -1 || checkfornumericPart(frm.txiPinNumber.value.substring(4,15)) == -1)
		{
			emsg+= "Pin Number is Not Corrert!\n";
		}


		if ( frm.txiAmount.value.length < 2  ){
				emsg += "Please enter the amount you are willing to Pay Online....!\nAtleast in two digits.";
				frm.txiAmount.value ="";
		}else if ( checkfornumeric(frm.txiAmount.value) == -1 ){
		emsg += "Please enter the amount you are willing to Pay Online....!CORRECTLY\n";
				frm.txiAmount.value ="";
				frm.txiAmount.focus();
		}
		
if ( emsg != ""){
	alert(emsg);
	return false;
}
/*	if (frm.selCurrencyType.value == "USD"){
		frm.finaltxiAmount.value = parseInt(frm.txiAmount.value) * ( 48 );
	}else{
		frm.finaltxiAmount.value = frm.txiAmount.value;
	}
	alert(frm.finaltxiAmount.value);*/
return true;
}

function checkforalphanumeric(sstr){
	var Flag = false;
	var valid = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

		for ( var i=0; i < sstr.length ; i++){

				var onechar = sstr.charAt(i);

					for ( var j=0; j < valid.length ; j++){
								
								var validonechar = valid.charAt(j);

									if ( onechar == validonechar ){
											Flag = true;
											break;
									}else{
										Flag = false;
									}
					}
		if ( Flag ==  false ){
				return -1;
		}


		}
if ( Flag == true )
return 1;

}
function checkfornumeric(sstr){
	var Flag = false;
	var valid = "0123456789";

		for ( var i=0; i < sstr.length ; i++){

				var onechar = sstr.charAt(i);

					for ( var j=0; j < valid.length ; j++){
								
								var validonechar = valid.charAt(j);

									if ( onechar == validonechar ){
											Flag = true;
											break;
									}else{
										Flag = false;
									}
					}
		if ( Flag ==  false ){
				return -1;
		}


		}
if ( Flag == true )
return 1;

}

function checkfornumericPart(sstr){
	var Flag = false;
	var valid = "0123456789";

		for ( var i=0; i < sstr.length ; i++){

				var onechar = sstr.charAt(i);

					for ( var j=0; j < valid.length ; j++){
								
								var validonechar = valid.charAt(j);

									if ( onechar == validonechar ){
											Flag = true;
											break;
									}else{
										Flag = false;
									}
					}
		if ( Flag ==  false ){
				return -1;
		}


		}
if ( Flag == true )
return 1;

}

function checkforalpha(sstr){
	var Flag = false;
	var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

		for ( var i=0; i < sstr.length ; i++){

				var onechar = sstr.charAt(i);

					for ( var j=0; j < valid.length ; j++){
								
								var validonechar = valid.charAt(j);

									if ( onechar == validonechar ){
											Flag = true;
											break;
									}else{
										Flag = false;
									}
					}
		if ( Flag ==  false ){
				return -1;
		}


		}
if ( Flag == true )
return 1;

}


function smile(){
window.open("http://www.diwaliutsav.com/smile.html","win1","menubar=0,location=no,status=no,directories=no,toolbar=no,scrollbars=no,height=332,width=350,resizable=no,alwaysRaised=yes,left=224,top=10")
}
function cry(){
window.open("http://www.diwaliutsav.com/smile.html","win1","menubar=0,location=no,status=no,directories=no,toolbar=no,scrollbars=no,height=332,width=350,resizable=no,alwaysRaised=yes,left=224,top=10")
}




function OpenModalDialog()
{
 var ReturnedValue = showModalDialog("http://www.palacesonwheels.com/video.html","","dialogWidth:425px;dialogHeight:344px;scroll:no;center:0;");
	
}

