var strDelete

function link_sort_field(strField) {
       strDelete=document.frmNew.txtDelete.value ;	   
       var a=document.frmNew.txtGUID.value;
       var prev_sort=document.frmNew.txtSortField.value;
       var order_type='ASC'; // set to ascending by default
       
       if(prev_sort==strField)
		{
			order_type=document.frmNew.txtOrder_type.value;	   
			if(order_type=='ASC')
			order_type='DESC';
			else
			order_type='ASC';
		}
       else
		{
			order_type=='ASC';
		}
	   
	   location = "PropertySearchResults.asp?GUID=" + a + "&txtSortField=" + strField +"&txtOrder_type=" + order_type + "&txtMove=A&strDelete=" + strDelete;
}


function onclick_add(intID, dsid)
{
		
	var intNoteHolderID = intID;
	var intNoteHolderType = '<%=Application("SL_item_id_Noteholder_Type_Property")%>';
	
	var loc = "NoteAddNew.asp?txtSortField=Time_Stamp&GB=Y&txtOrder_type=DESC&Mode=Popup" +
	"&NoteHolder_Type_ID=" + intNoteHolderType + "&NoteHolder_ID=" + intNoteHolderID + 
	"&Data_Source_ID=" + dsid + "&Related_Record_ID=" + intID;
	
	//var loc = "NoteAddNew.asp?&txtSortField=Note_ID&Mode=Popup&GB=Y&Data_Source_ID=" + DSID + "&Related_Record_ID=" + intID;
	
	window.open(loc,"_blank","height=600,width=800,resizable=yes,scrollbars=yes");
}

function link_view(intID) 
{
	
       var b=document.frmNew.txtSortField.value;
	   var order_type=document.frmNew.txtOrder_type.value;
	   
	   var loc = "PropertiesViewPretty.asp?Mode=Popup&Property_ID=" + intID;
	   
	   window.open(loc,"_blank","height=600,width=800,resizable=yes,scrollbars=yes");
	   
}

function link_edit(intID,intCID){
	var b=document.frmNew.txtSortField.value;
	var order_type=document.frmNew.txtOrder_type.value;
	   
	var loc = "PropertiesEdit.asp?Property_ID=" + intID + "&Customer_ID=" + intCID;
	location = loc;	   
	   
}

function link_photo(intID,intCID)
	{
	   //alert(intid); 
       
	   location = "PropertiesPhotoList.asp?Property_ID=" + intID + "&Customer_ID=" + intCID;
	  
    }


function link_rent(intID) 
{
	
       var b=document.frmNew.txtSortField.value;
	   var order_type=document.frmNew.txtOrder_type.value;
	   
	   var loc = "RentProperty.asp?Mode=Popup&Property_ID=" + intID;
	   
	   window.open(loc,"_blank","height=600,width=800,resizable=yes,scrollbars=yes");
	   
}

function link_avail(intID,intCID)
	{
	   //alert(intid); 
       var b=document.frmNew.txtSortField.value;
	   //var order_type=document.frmNew.txtOrder_type.value;
	   	    
	   location = "PropertiesAvailList.asp?Property_ID=" + intID + "&Customer_ID=" + intCID 
	   + "&txtSortField=Start_Date" ;
	   
    }
    
function link_map(add,city,state,country,zip)
{
	var address = add.split(" ");
	
	var strAdd = "";
	var i =0;
	
	for (i=0;i<address.length;i++)
	{
		if(strAdd == "")
		{
			strAdd = address[i];
		}
		else
		{
			strAdd = strAdd + "+" + address[i];
		}
		
	}
	
	var strCity = city;
	var strState = state;
	var strCountry=country;
	var strZip = zip;
	
	//var loc ="http://www.mapquest.com/maps/map.adp?city=denver&state=CO&address=1565+california+st&zip=80202&country=us&zoom=5";
	
	//var loc ="http://www.mapquest.com/maps/map.adp?city=" + strCity + "&state=" + strState +
	//"&address=" + strAdd + "&zip=" + strZip + "&country=" + strCountry + "&zoom=5";
	
	//alert(loc);
	
	var loc ="http://www.mapquest.com/maps/map.adp?countrycode=110&city=Mumbai";
	window.open(loc,"Map","height=600,width=800,scrollbars=yes,resizable=yes");

}

function link_select(intID,strName){
	var idstrval = document.getElementById("txtIDFieldName").value;
	window.opener.document.getElementById(idstrval).value = intID;

	var txtstrval = document.getElementById("txtNameFieldName").value;
	window.opener.document.getElementById(txtstrval).value = strName;
	
	window.close();

}

function link_select_and_stay(intID,strName){
	var idstrval = document.frmNew.txtIDFieldName.value;
	var idstr = "window.opener.document.all." + idstrval;
	var idfield = eval(idstr);
	
	
	var txtstrval = document.frmNew.txtNameFieldName.value;
	var txtstr = "window.opener.document.all." + txtstrval;
	var txtfield = eval(txtstr);
	
	if (idfield.value == ""){
		idfield.value = intID;
		txtfield.value = strName;
	}
	else{
		idfield.value = idfield.value + ', ' + intID;
		txtfield.value = txtfield.value + ', ' + strName;
	}
}

function link_select_and_save(intID,strName){
	var idstrval = document.frmNew.txtIDFieldName.value;
	var idstr = "window.opener.document.all." + idstrval;
	var idfield = eval(idstr);
	
	
	var txtstrval = document.frmNew.txtNameFieldName.value;
	var txtstr = "window.opener.document.all." + txtstrval;
	var txtfield = eval(txtstr);
	
	var markerstr = "window.opener.document.all.txtMarker";
	var markerfield = eval(markerstr);

	if (idfield.value == ""){
		idfield.value = intID;
		txtfield.value = strName;
	}
	else{
		idfield.value = idfield.value + ', ' + intID;
		txtfield.value = txtfield.value + ', ' + strName;
	}
	markerfield.value = "go"
	
	window.close();
}

function link_trade(intID, TSTS){
	var loc = "MemberTradesAddNew.asp?txtRequestType=" + TSTS + "&Property_ID=" + intID;
	
	location = loc;
}

function link_favorite(intID){
	if(confirm("We will send you an email any time new availability is posted for your Favorite Properties.")){
		window.open("AddToFavorites.asp?Property_ID=" + intID);
	}
}

function link_guestbook(intID)
{
	var loc="GuestBookView.asp?Property_ID=" + intID;
	window.open(loc,'_blank','height=600,width=800,resizable=yes,scrollbars=yes');
}

function link_member_edit(intID)
{
	var loc="CustomerEdit.asp?Customer_ID=" + intID;
	window.open(loc,'_blank','height=600,width=800,resizable=yes,scrollbars=yes');
}

function link_property_edit(intID){
	var loc="PropertiesEdit.asp?Property_ID=" + intID;
	window.open(loc,'_blank','height=600,width=800,resizable=yes,scrollbars=yes');
}

function link_zpzp(intID)
{
	var loc="ZPZPList.asp?mode=add&Property_ID=" + intID;
	location=loc;	
}

function btnPrev_onclick()
	{   
       var a=document.frmNew.txtGUID.value;
       var b=document.frmNew.txtSortField.value;
		var order_type=document.frmNew.txtOrder_type.value;
		var cid=document.frmNew.txtCustID.value;
		var pc=document.frmNew.txtPropCode.value;
		var mode = document.frmNew.txtMode.value;
		var idfield = document.frmNew.txtIDFieldName.value;
		var txtfield = document.frmNew.txtNameFieldName.value;	
		
	   location = "PropertySearchResults.asp?GUID=" + a + "&txtSortField=" + b +
	    "&txtOrder_type=" + order_type + "&CustID=" + cid + "&Prop_Code=" + pc +
	    "&txtMove=P&strDelete=" + strDelete + "&Mode=" + mode +
	    "&IDFieldName=" + idfield + "&NameFieldName=" + txtfield;
    }


function btnNext_onclick() 
	{
       var a=document.frmNew.txtGUID.value;
       var b=document.frmNew.txtSortField.value;
	   var order_type=document.frmNew.txtOrder_type.value;
	   var cid=document.frmNew.txtCustID.value;
		var pc=document.frmNew.txtPropCode.value;
		
		var mode = document.frmNew.txtMode.value;
		var idfield = document.frmNew.txtIDFieldName.value;
		var txtfield = document.frmNew.txtNameFieldName.value;		
		
	   location = "PropertySearchResults.asp?GUID=" + a + "&txtSortField=" + b + 
	    "&txtOrder_type=" + order_type + "&CustID=" + cid + "&Prop_Code=" + pc +
	    "&txtMove=N&strDelete=" + strDelete + "&Mode=" + mode +
	    "&IDFieldName=" + idfield + "&NameFieldName=" + txtfield;
	    
	 }



function frmNew_onload(form){
   form.btnPrev.disabled = true
}

function window_onload() {
	
return true;
}


function btnBackToSearch_onclick()
{
	var mode = document.frmNew.txtMode.value;
	var idfield = document.frmNew.txtIDFieldName.value;
	var txtfield = document.frmNew.txtNameFieldName.value;	
		
	location = "vacation-property-search.asp?Mode=" + mode +
	    "&IDFieldName=" + idfield + "&NameFieldName=" + txtfield;
	
}

function btnBackToOldSearch_onclick(intGUID)
{
	var mode = document.frmNew.txtMode.value;
	var idfield = document.frmNew.txtIDFieldName.value;
	var txtfield = document.frmNew.txtNameFieldName.value;	
		
	location = "vacation-property-search.asp?Curr_GUID=" + intGUID + "&Mode=" + mode +
	    "&IDFieldName=" + idfield + "&NameFieldName=" + txtfield;
	
}


function btnBackToBrowse_onclick()
{
	location = "browse-vacation-destinations.asp";
	
}

function btnBackToFractBrowse_onclick()
{
	location = "browsefractional.asp";
	
}

function btnBackToForSale_onclick()
{
	location = "browse-properties-forsale.asp";
	
}

function btnBackToForRent_onclick()
{
	location = "browse-properties-forrent.asp";
	
}

function btnBackToDD_onclick(MCID){
	location = "DesiredDestinations.asp?Customer_ID=" + MCID;
}

function window_onunload() {
	strDelete = "";
}

