/**
 * @author leesean
 */
/*
 $(function() {
	 //$('.date-pick').datePicker().val(new Date().asString()).trigger('change');
	 $('#start-date').bind(
		'dpClosed',
		function(e, selectedDates)
		{
			var d = selectedDates[0];
			if (d) {
				d = new Date(d);
				$('#end-date').dpSetStartDate(d.addDays(1).asString());
			}
		}
	);
	$('#end-date').bind(
		'dpClosed',
		function(e, selectedDates)
		{
			var d = selectedDates[0];
			if (d) {
				d = new Date(d);
				$('#start-date').dpSetEndDate(d.addDays(-1).asString());
			}
		}
	);
});*/

function loadSearchName(){
	$('#search_bg').load('/search/m3searchname/');
}

function loadSearchDate(){
	$('#search_bg').load('/search/m3searchdate/');
}

function loadSearchLocation(){
	$('#search_bg').load('/search/m3searchlocation/');
}

function submitBtu(e){
	if(window.event){ // IE
		keynum = e.keyCode;
	}
	else if(e.which){ // Netscape/Firefox/Opera
		keynum = e.which;
	}	
	if(keynum==13){   
		document.frmSearch.btnSearch.click(); 
		return false; 
	}
	else{
		return true;
	} 
} 


function submitdata_qname(){
	var qname = document.getElementById("searchName").value;
	qname=qname.replace(',','');
	qname=qname.replace('/','');
	if (qname != '') {
		window.location='/search/resultSearch/?keyword='+encodeURI(qname);
		//window.location.href = '/fun/search/qname/0/' + qname;
		return false;
	}
}

function submitdata_qlocation(){
	var qlocation = document.getElementById("searchLocation").value;
	qlocation=qlocation.replace(',','');
	qlocation=qlocation.replace('/','');
	if (qlocation != '') {
		window.location='/search/resultSearch/?addresskeyword='+encodeURI(qlocation);
		//window.location.href = '/fun/search/qlocation/1/' + qlocation;
		return false;
	}
}

function submitdata_qdate(){
	var sdate = document.getElementById("start-date").value;
	var edate = document.getElementById("end-date").value;
	var city = document.getElementById("EventCitycodeId").value;
	if (sdate != '') {
		window.location='/search/resultSearch/?sdate='+ sdate + '&edate=' + edate +'&city='+city+',,';
		//window.location = '/fun/search/qdate/0/' + sdate + '/' + edate;
		return false;
	}
}	

