﻿
/*
@num: The number of the message array.
id must be there in the html page eg. id_0 to access first message
**/

// constant
var siteTitle = "MyTripDoor";
var AlbumDelete	='Do you want to delete this album?';
var DeletePlacematPhoto	='Are you sure you want to delete this comment?';
var Uploadvideo	='Please upload video file.';
var Uploadvideocaption	='Please add caption for  this video.';
var contStr="Enter text about your place in this box. Include that perfect photo as the main image, and then start adding stuff in the modules below. You can also drag and drop them wherever you want on the page.\n\nStumped?\n\nClick on the ? in each module for info on how to build TripDoors and win the most points.";
var deletemsg ='Are you sure you want to delete this item?' 
var deletecomment ='Are you sure you want to delete this comment?';
var cmtblk ='Comment cannot be blank?';
var revname ='Please enter the review name.';
var revcity ='Please enter the review city.';
var cancelbut ='Are you sure you want to cancel?';
var deletePlacemat ='Deleting a TripDoor would result in deletion of all relative photo album(s), video album(s), music album(s), review(s), article(s), book(s) and website(s). Are you sure you want to delete?';
var deleteAccount = 'Deleting your account would result in deletion of your account information including all private and friend Trip Doors and their relative photo album(s), video album(s), music album(s), review(s), article(s), book(s) and website(s). Are you sure you want to delete your account?';

//This array is used in lightbox.js and also in add_favorite function below. Hide and display flash object globally.
var $arr = Array('video_player_box', 'music_player_box');

// validation .js


	//For Selecting/ deselecting check boxed
	function selectDeselect(field, isCheck) {
		var boxes = document.getElementsByName(field);
		var boxes_checked = anyChecked();
		if(isCheck){
			if(document.getElementsByName(isCheck)[0].checked) setChecks(true);
			else setChecks(false);			
		}else{
			if(!boxes_checked) setChecks(true);
			else setChecks(false);
		}
		function setChecks( setting ) {
			for( var i=0; i < boxes.length; i++ ) {
				boxes[ i ].checked = setting;
			}
		}
		function anyChecked() {
			for( var i=0; i < boxes.length; i++ ) {
				if( boxes[i].checked == true) {
					return (true);
				} 
			}
			return (false);
		}
	}
	
	function validatePassword(fld) {
    var error = "";
   // var illegalChars = /[\W_]/; // allow only letters and numbers 
 
    if (fld.value == "") {
        fld.style.background = 'Yellow';
        error = "Oops!!! You missed entering the Password. \n";
    }else if ((fld.value.length < 6) || (fld.value.length > 15)) {
        error = "Your Password must be 6 to 15 characters long. \n";
        fld.style.background = 'Yellow';
    }else if(fld.value.indexOf(" ")!=-1){
        error = "Hmm!!! Space character not allowed. Kindly re-enter Password. \n";
        fld.style.background = 'Yellow';
	}else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))){
        error = "The password must contain at least one numeral.\n";
        fld.style.background = 'Yellow';
    }else{
        fld.style.background = 'White';
    }
	/*else if (illegalChars.test(fld.value)) {
        error = "Hmm!!! Special characters not allowed. Kindly re-enter Password. \n";
        fld.style.background = 'Yellow';
    } */
   return error;
}  


function validateUrl(fld) {
    var error = "";
    var illegalChars = /\W/; // allow letters, numbers, and underscores
    if (fld.value == "") {
        fld.style.background = 'Yellow'; 
        error = "Oops!!! You missed entering the url.\n";
    } else if ((fld.value.length < 5) || (fld.value.length > 25)) {
        fld.style.background = 'Yellow'; 
        error = "Your Url must be 5 to 20 characters long.\n";
    } else if (illegalChars.test(fld.value)) {
        fld.style.background = 'Yellow'; 
        error = "Hmm!!! Special characters not allowed. Kindly re-enter Url.\n";
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function validatetag(fld) {
    var error = "";
    var illegalChars = /\W/; // allow letters, numbers, and underscores, spaces
    if (fld.value == "") {
        fld.style.background = 'Yellow'; 
        error = "Oops!!! You missed entering the tag.\n";
    } else if (illegalChars.test(fld.value)) {
         fld.style.background = 'Yellow'; 
         error = "Hmm!!! Special characters not allowed. Kindly re-enter the tag.\n";
	} else {
        fld.style.background = 'White';
    }
    return error;
}
	//For checking Null values
	function isNull(aStr){
		var index;		
		for (index=0; index < aStr.length; index++)
			if (aStr.charAt(index) != ' ')
				return false;
		return true;
	}
	
	//For checking invalid E-Mail address

	function isEmail(aStr){
		var reEmail=/^[0-9a-zA-Z_\.-]+\@[0-9a-zA-Z_\.-]+\.[0-9a-zA-Z_\.-]+$/;
		if(!reEmail.test(aStr)){
			return false;
		}
		return true;
	}
	
	//Removing the newline character
	function countChars(str){
		var reg = new RegExp("[\f\n\r\v]*","g");
		str = str.replace(reg,"");
		return str.length;   
	}
	
	function IsValidNumericValue(strVal){
		nNoOfArguments = IsValidNumericValue.arguments.length;
		//if any of the three parameter is not supplied
		if(nNoOfArguments < 1){
			return false;
		}	

		//valid characters a supplied string can have
		var sValidChars = "0123456789";
		strVal = new String(strVal);	//convert the value to a string object
		var bReturn = true
		var i = new Number(0);
		//if number is 0
		if(0 == parseInt(strVal,10))
			return true;

		//if first character is 0
		if(0 == strVal.charAt(0))
			return false;
		while ((bReturn) && (i < strVal.length)){
			bReturn = (sValidChars.indexOf(strVal.charAt(i)) >= 0)
			i++
		}
		return (bReturn);
	}
	
	function trim(s) {
	while (s.substring(0,1) == ' ') {
		s = s.substring(1,s.length);
	}
	while (s.substring(s.length-1,s.length) == ' ') {
		s = s.substring(0,s.length-1);
	}
	return s;
}

function imageCheck(datacheck)
 { //making sure the user only uploads jpeg, jpg, gif, tif and png files.
 var testStr = '.jpeg.jpg.JPG.JPEG.png.PNG.gif.GIF';
 var txt = datacheck.value;
 //just for illustration!
 if (testStr.indexOf(txt.substring(txt.lastIndexOf('.'))) == -1){
 return false;
 }
 return true;
 }
 
 function audioCheck(datacheck)
 { //making sure the user only uploads jpeg, jpg, gif, tif and png files.
 var testStr = '.mp3.MP3';
 var txt = datacheck.value;
 //just for illustration!
 if (testStr.indexOf(txt.substring(txt.lastIndexOf('.'))) == -1)
 {
 return false;
 }
 return true;
 }
 
 function videoCheck(datacheck){ //making sure the user only uploads jpeg, jpg, gif, tif and png files.
 var testStr = '.mp4.MP4.wmv.WMV.wav.WAV.avi.AVI.mpeg.MPEG';
 var txt = datacheck.value;
 //just for illustration!
 if (testStr.indexOf(txt.substring(txt.lastIndexOf('.'))) == -1){
 return false;
 }
 return true;
 }
 

function LeapYear(intYear) {
	if (intYear % 100 == 0) {
		if (intYear % 400 == 0) { return true; }
	}else { 
		if ((intYear % 4) == 0) { return true; }
	}
	return false;
}


/* Date format mm/dd/yyyy */
function checkDate(dt){
	var reg = new RegExp("[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}$");
	if(reg.test(dt)){
		var datepart = dt.split("/");
		for(i=0;i<datepart.length;i++)
			datepart[i] = parseInt(parseFloat(datepart[i]));
		if(datepart[0] > 31 || datepart[1] > 12)
			return false;
		else if((datepart[1] == 4 || datepart[1] == 6 || datepart[1] == 9 || datepart[1] == 11) && datepart[0] == 31)
			return false;	
		else if(datepart[1] == 2){
			if(datepart[0] > 29)
				return false;
			if(!LeapYear(datepart[2]) && datepart[0] == 29)
				return false;
		}
		return true;						
	}
	return false;			
}
		
/*  
     Dates accepted in dd/mm/yyyy format
     Return Code          Condition
	 -------------------------------
	    -1              dt1 less than dt2
	     0              dt1 equal to dt2
  	     1     	        dt1 greater than dt2		        
*/

function compareDates(dt1,dt2){
	var datepart1 = dt1.split("/");
	var datepart2 = dt2.split("/");
	for(i=0;i<datepart1.length;i++){
		datepart1[i] = parseInt(parseFloat(datepart1[i]));
		datepart2[i] = parseInt(parseFloat(datepart2[i]));		
	}	
	if(datepart1[2] > datepart2[2])
		return 1;
	else if(datepart1[2] < datepart2[2])	 
		return -1;
	else if(datepart2[2] == datepart1[2]){
		if(datepart1[1] > datepart2[1])
			return 1;
		else if(datepart1[1] < datepart2[1])	
			return -1;
		else if(datepart1[1] == datepart2[1]){
			if(datepart1[0] > datepart2[0])
				return 1;
			else if(datepart1[0] < datepart2[0])	
				return -1;			
		}
	}
	return 0;	
}
//changeDateFormat(dt,from_format,to_format)
function changeDateFormat(dt,from_format,to_format)
{
	var converted_date  = new Array(3);		
	var datepart        = dt.split("/");        
	var from_formatpart = from_format.split("/");
	var to_formatpart   = to_format.split("/");
	for(i=0;i<3;i++)
	{
		for(j=0;j<3;j++)
		{
			if(to_formatpart[j] == from_formatpart[i])  	
			{
				converted_date[j] = datepart[i];  			
				break;
			}
		}
	}	
	return (converted_date[0]+"/"+converted_date[1]+"/"+converted_date[2]);	
}

function clearData(){
	if(document.getElementById("txtsearch").value=='Search'){
		document.getElementById("txtsearch").value='';
	}
}	
	
function Arraysearch( searchS, arraySA ) {
 var I = 0;
 var minI = 0;
 var maxI = arraySA.length - 1;
 //
 var s = "";
 //
 var foundB = false;
 //
 I = minI - 1;
 while ( ( I <= maxI ) && ( !( foundB ) ) ) {
  I = I + 1;
  s = arraySA[ I ];
  foundB = ( searchS == s );
  }
 if ( foundB ) {
  return( I );
 }
 else {
  return( -1000 ); // some negative number indicating not found
 }
}
	function validatechars(fld) 
	{
    var error = "";
    var illegalChars = /[\W_]/; // allow only letters and numbers 
 
    if (fld.value =="") {
        fld.style.background = 'Yellow';
        error = "Oops!!! You missed entering the category. \n";
    } 
    else if ((fld.value.length > 15)) {
        error = "Your category have  Max. 15 characters allowed. \n";
        fld.style.background = 'Yellow';
    } 
	else if(fld.value.indexOf(" ")!=-1)
	{
        error = "Hmm!!! Space character not allowed. Kindly re-enter category. \n";
        fld.style.background = 'Yellow';
	}
	else if (illegalChars.test(fld.value)) {
        error = "Hmm!!! Special characters not allowed. Kindly re-enter category. \n";
        fld.style.background = 'Yellow';
    } 
	/*else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))) {
        error = "The category must contain at least one numeral.\n";
        fld.style.background = 'Yellow';
    } */else {
        fld.style.background = 'White';
    }
   return error;
}  


/**
	@param url: Redirect the window to the location of the url. eg. /admin/blogs
	usually this is used on the click of the cancel button
*/
function redirect(url){
	if(url!=''){
		location.href=url;
	}
	return false;
}

/**
  @msg:string > Message that will be passed on javascript delete click;
*/
function confirmMsg(msg){
	return confirm(msg);
}





/**
 Absolute position needs to be provided to display the div. Message array should also be predefined to display the message.
 @param num Integer: Number that will be suffixed with (id_)
 @param left Integer: Left position of the callout div
 @param top Integer: Top position of the callout div

*/
function showMsg(num, left){
	var obj = $("id_"+num);
	obj.style.position	= 'absolute';
	if(parseInt(left) > 0){
		obj.style.left		= left+'px';
	}else{
		obj.style.left		= leftCallOut+'px';
	}
	//obj.style.top		= top+'px';
	obj.style.zIndex	=10;

	obj.innerHTML		= '<div id="callout" style="float:left;"><div id="callout_top">&nbsp;</div><div class="callout_text">'+message[num]+'</div><div style="float:left;"><img src=\'/img/callout_bottom.gif\' class=\'img_def\' /></div></div>';
	obj.className		= 'shown';
}

function showMsg1(num, left){
	var obj = $("id_"+num);
	obj.style.position	= 'absolute';
	
	if(parseInt(left) > 0){
		//obj.style.top		= 30+'px';
		obj.style.left		= left+'px';
	}else{
		//obj.style.top		= 30+'px';
		obj.style.left		= 520+'px';
	}
	obj.style.zIndex	=10;
	obj.innerHTML		= '<div class="main_tooltip" style="margin-top:-30px !important;margin-top:0px;"><div id="callout_reverse_">&nbsp;</div><div id="callout1_" style="clear:both;"><div class="callout_text2">'+message[num]+'</div></div><div class="floatl" style="margin-top:-2px;height:10px;"><img src=\'/img/callout_reverse_bottom_.gif\' class=\'borderclass\' width=\'233px\' height=\'10px\' /></div></div>';
	obj.className		= 'shown';
}
/**
@param num Integer: Hide the id (id_)
*/
function hideMsg(num){
	var obj = $("id_"+num);
	obj.className = 'hide';
}

function show(id){
	var obj = $(id);
	obj.className = 'show';
}

function hide(id){
var obj = $(id);
	obj.className = 'hide';
}

function loadPopUp(url, value){
	 var param="";
	 
	 showLightbox(param);
	 //Hide particular divs if required. This is required when there is flash player.
	 switch(value){
		 case "homepage_slideshow":
			 document.getElementById('slide').style.display='none';
			 document.getElementById("video").style.display="none";
			 break;
	 }

	 new Ajax.Updater('upload_img', url, {onLoading:function(request){Element.show('search_spinner')},onComplete:function(request){ Element.hide('search_spinner');}});
	 document.getElementById("upload_img").style.display = "block";

	 return false;
}

function editimage(){
 	 var param="";
     showLightbox(param);
	 new Ajax.Updater('upload_img', '/members/upload_file', {onLoading:function(request){Element.show('search_spinner')},onComplete:function(request){ Element.hide('search_spinner');}});
	 document.getElementById("upload_img").style.display = "block";
	 return false;
}
function uploadimage(){
	 var param="";
     showLightbox(param);
	 document.getElementById('slide').style.display='none';
	 document.getElementById("video").style.display="none";
	 new Ajax.Updater('upload_img', '/members/upload_picture', {onLoading:function(request){Element.show('search_spinner')},onComplete:function(request){ Element.hide('search_spinner');}});
	 document.getElementById("upload_img").style.display = "block";
	 return false;
}


function editaboutme(){
 	 var param="";
	 new Ajax.Updater('editContent', '/members/about_form');
	 return false;
}

function add_favorite(divs,url){
	//Hide all flash objects.
	for(i=0; i<$arr.length; i++){
		try{
			document.getElementById($arr[i]).style.display = 'none';
		}catch(exception){
		
		}
	}
	showLightbox('','upload_img');
	$('upload_img').style.display="block";
	new Ajax.Updater('upload_img', url, {onLoading:function(request){Element.show('search_spinner')},onComplete:function(request){ Element.hide('search_spinner');}});//$('upload_img').innerHTML='';
	return false;
}

function hides(){
	document.getElementById('upload_img').style.display="none";
	hideLightbox();
}

function submits(){
	//alert({parameters:Form.serialize($("edit"))} );
	 new Ajax.Updater('editContent', '/members/about_form',{parameters:Form.serialize($("edit"))});
	 return false;
}

function cancels(){
if(confirm(cancelbut)){
$('cancel').value='cancel';
 new Ajax.Updater('editContent', '/members/about_form',{parameters:Form.serialize($("edit"))});
}
 return false;
}

function refresh_form(){
	 new Ajax.Updater('update_me', '/members/updateprofile/2');
}

function checkuploads(){
	if(document.getElementById('txtimg').value ==''){
		alert('Please select image file to upload');
		document.getElementById('txtimg').focus();
		return false;
	}
}


/* browser detect*/

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


// star rating 

function callrate(rate,photoid,url){
	new Ajax.Updater('divrate',url + '/' + rate + '/' + photoid,{onLoading:function(request){Element.show('spinner')},onComplete:function(request){ Element.hide('spinner');}});
}


/**
@value = this object of <a href>
This function is used for top search form.
*/
function changeClass(value){
	document.getElementById('search_placemat').className	= '';
	document.getElementById('search_member').className	= '';
	document.getElementById('search_blog').className		= '';
	document.getElementById('search_music').className		= '';
	document.getElementById('search_review').className		= '';
	document.getElementById('search_video').className		= '';
	document.getElementById('search_web').className		= '';
	value.className = 'active';
	var searchValue = value.id;
	document.getElementById('search_mode').value = '/search/'+searchValue.replace(/search_/,'');
}

/**
action will be changed dynamically onSubmit of search form.
*/
function actSearch(){
if(document.getElementById('search').value=='Enter any destination or place.'){
	document.getElementById('search').value='';
}	
if(document.getElementById('search_mode').value=='/search/web'){
		document.getElementById('q').value=document.getElementById('search').value;
		document.getElementById('searchbox_005268708800135730555:8wloqt4zggq').submit();
		return false;
	}else{
		document.getElementById('frmSearch').action = document.getElementById('search_mode').value;
		document.getElementById('frmSearch').submit();
	}
}


function isdefined(variable){
	return (typeof(variable) == "undefined")?  false: true;
} 

function plcsearchsort(searchmode,placematsort){
	var mode,selectval;
	mode = document.getElementById(searchmode).value;
	selectval = document.getElementById(placematsort).value;
	if(searchmode==''){
	location.href="/placemats/"+selectval;
	}else{
	location.href="/search/"+ mode +"/"+selectval;
	}
	return false;
}

function pepsearchsort(searchmode,placematsort){
	var mode,selectval;
	mode = document.getElementById(searchmode).value;
	selectval = document.getElementById(placematsort).value;
	if(searchmode==''){
		location.href="/people/" + selectval;
	}else{
		location.href="/search/"+ mode +"/"+selectval;
	}
}

function hideshowsearch(docid){
 dureff=0.2;
 val=document.getElementById("showhidelabel").innerHTML;
 if(val=="Hide"){
	new Effect.Fade(window.parent.document.getElementById(docid), { duration: dureff });
	document.getElementById("showhidelabel").innerHTML="Show";
 }else{
   new Effect.Appear(window.parent.document.getElementById(docid), { duration: dureff });
   document.getElementById("showhidelabel").innerHTML="Hide";
 }
}
function chgaction(){
   new Ajax.Updater('divairline', '/rewards/selairlineconversion', {parameters: Form.Element.serialize('airlineid')});
}
// slideshow
function slideshow(){
var oeParam='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="298" height="251" id="slideshow" align="middle" transparent="true"><param name="allowScriptAccess" value="sameDomain" /><param name="movie"  value="/flash/slideshow.swf?xmlPath=files/gallery/xml/gallery.xml&photoframe=/flash/photoframe.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="/flash/slideshow.swf?xmlPath=files/gallery/xml/gallery.xml&photoframe=/flash/photoframe.swf" quality="high" bgcolor="#ffffff" width="298" height="251" name="slideshow" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>'
document.write(oeParam);
}
/**
* @param url of page
*/
function message(url){
	var param="";
	new Ajax.Updater('upload_img', url, {onLoading:function(request){Element.show('search_spinner')},onComplete:function(request){ Element.hide('search_spinner');}});
	$("upload_img").style.display="block";
}

/**
*  review
*/
function uploadreview(){
	if(trim($('rname').value)==''){
		alert(revname);
		$('rname').focus();
		return false;
	}
	/*if(trim($('rcity').value)==''){
		alert(revcity);
		$('rcity').focus();
		return false;
	}*/
}

// contact search
function contactsearch(){
 new Ajax.Updater('contactlist', '/members/contactlist/search',{parameters:Form.serialize($("contact"))});
}

function tools(url,first,second){
 new Ajax.Updater('update1',url);
  //alert(datePickerDivID);
  try{
	updateDateField(first);
    updateDateField(second);
  }catch(err){
  	
  }
}

function uploadPlacemat(placematid){
	var param = " ";
	showLightbox(param);
	new Ajax.Updater('upload_img',"/placemats/upload_file/" + placematid, {onLoading:function(request){Element.show('search_spinner')},onComplete:function(request){ Element.hide('search_spinner');}});
	document.getElementById("upload_img").style.display = "block";
}

function saveeditarticle(Msg,PlacematId){
  //if(confirm(Msg)){
	create.action='/placemats/blogs_edit/'+PlacematId;
 // }else{
	//return false;  
 // }
}

function savearticle(Msg){
  /*if(confirm(Msg)){
  }else{
	return false;  
  }*/
}

function savereview(Msg,PlacematId){
	if(trim($('rname').value)==''){
		alert(revname);
		$('rname').focus();
		return false;
	}
	
 /* if(confirm(Msg)){
	//document.getElementById('frmreviews').action='/placemats/reviews/'+ PlacematId;
  }else{
	return false;  
  }*/
}

function savePage(id){
	if(confirm('It looks like you have some unsaved changes on this page. Would you like to SAVE these changes (OK) or DISCARD them (CANCEL)?')){
   	  chkForm();
	  document.getElementById('redirect').value=document.getElementById(id).href;
	  document.getElementById('frm_pmi').submit();
	  return false;
	}
		
	
}
function saveEdit(id){
	if(confirm('It looks like you have some unsaved changes on this page. Would you like to SAVE these changes (OK) or DISCARD them (CANCEL)?')){
//   	  chkForm();
	  document.getElementById('edit').submit();
	  document.getElementById('redirect').value=document.getElementById(id).href;
	  return false;
	}
}

function savemodules(id){
   	  chkForm();
	  document.getElementById('redirect').value=document.getElementById(id).href;
	  document.getElementById('').submit();
	  return false;
}
function showElements(theForm) {   
	str = "http://www.sidestep.com/air/quick_search.do;jsessionid=E924C2821B81FF025E08F429B9A6AD7D.n116?"   
//	str = "http://www.sidestep.com/air/quick_search.do?";
	for (i = 0; i < theForm.length; i++){    
	if(theForm.elements[i].name == 'rdate'){
		
	}
	str += theForm.elements[i].name + "=" + theForm.elements[i].value + "%26";
		//alert(theForm.elements[i].name + "=" + theForm.elements[i].value);
	}
	//document.write(str);
	window.open(str);
}

function playmusic(xmlfile)
{
	 
	var objparam='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="520" height="103" id="palyer_flash" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/flash/palyer_flash.swf?xmlpath='+xmlfile+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="/flash/palyer_flash.swf?xmlpath='+xmlfile+'"  quality="high" bgcolor="#ffffff" width="520" height="103" name="palyer_flash" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';  
	
	document.write(objparam);      
  
 }

 function chkcancel(link){
	if(confirm(cancelbut)){
	 window.location.href = link;
	 return true;
	}
	 }
 function delete_placemat(placematId){
 	if(confirm(deletePlacemat)){
		location.href = "/placemats/placematdel/"+placematId;
	}
	else{
		return false;
	}
	return false;
 }
 function delete_account(){
		location.href = "/members/memberdel/";
 }