// FUNCTIONS HANDLING IMPORTED CONTENT


// Popup active listings in tract
function viewTractListings(citycode, tract) {
	w = 617;
	h = 670;
	var url = "";
	var city;

	switch (citycode) {
	  case "ln":	city = "Laguna%20Niguel"; break;
	  case "lb":	city = "Laguna%20Beach"; break;
	  case "dp":	city = "Dana%20Point"; break;
	  case "av":	city = "Aliso%20Viejo"; break;
	  case "sc":	city = "San%20Clemente"; break;
	  case "nc":	city = "Newport%20Coast"; break;
	  case "nb":	city = "Newport%20Beach"; break;
	  case "cdm":	city = "Corona%20Del%20Mar"; break;
	  default:	city = "";
	}

	url = "http://www.searchpoint.net/list.asp?_account=idd&_sponsor_type=Agent&_account_id=casocal_SLAMPCHR&_trace=0&_org_id=casocal&_pType=1&_any_f=0&_any_l=0&state=ca&_slog_type=1&_measuring_system=E&_ver=5&_agent_email=christine@ocvillas.com&_menusOrig=99&_adv_srch=0&property_type=RES&*tract_code*=" + tract + "&_count=30&_lid=0&_wpid=1&_new=1&_agent_public_id=SLAMPCHR&city_name=" + city + "&_sponsor_office_id=LPTB&_sponsor_org_id=CASOCAL&_start=1";
	popUp(url, "listingswin", w, h, 1);
}


// Popup listing by mls number
function viewListing(mlsnum) {
	w = 617;
	h = 520;
	var url = "";

	url = "http://www.searchpoint.net/list.asp?_account=idd&_sponsor_type=Agent&_account_id=casocal_SLAMPCHR&_trace=0&_org_id=casocal&mls_property_id=L22625&_slog_type=1&_ver=5&_agent_email=christine@orangecoastvillas.com&_menusOrig=99&_per_id=4527F56CC0B94DDD989114FD7D0C1F1D&_lid=0&_mls_id1=" + mlsnum + "&_wpid=1&_new=1&_agent_public_id=SLAMPCHR&_sponsor_org_id=CASOCAL&_start=1"
	popUp(url, "listingswin", w, h, 1);

}

// Special case tract listings function for new tracts with no tract id in the mls (search by street)
function viewLavistaListings() {
	w = 617;
	h = 670;
	var url = "";
	
	url = "http://www.searchpoint.net/list.asp?_account=idd&_sponsor_type=Agent&_account_id=casocal_SLAMPCHR&_trace=0&_org_id=casocal&_pType=1&_any_f=0&_any_l=0&state=ca&_slog_type=1&_measuring_system=E&_ver=5&_agent_email=christine@ocvillas.com&_menusOrig=99&_adv_srch=0&property_type=RES&_count=30&_lid=0&_wpid=1&_client_name=Christine%20Lampert&_new=1&_agent_public_id=SLAMPCHR&city_name=Laguna%20Niguel&_sponsor_org_id=CASOCAL&_start=1&*street_name*=CLUBHOUSE";
	popUp(url, "listingswin", w, h, 1);

}

// Popup active listings by price
function viewListingsByPrice(citycode, restypecode, low, high) {
	w = 617;
	h = 670;
	var url = "";
	var type; 
	var city;

	if (restypecode == 1) {
	  type = "TWN,CON,COO,COOP,OYO,TWNHS,CONDO,NSF";
	} else 
	  type = "SFR";

	switch (citycode) {
	  case "ln":	city = "Laguna%20Niguel"; break;
	  case "lb":	city = "Laguna%20Beach"; break;
	  case "dp":	city = "Dana%20Point"; break;
	  case "av":	city = "Aliso%20Viejo"; break;
	  case "sc":	city = "San%20Clemente"; break;
	  case "nc":	city = "Newport%20Coast"; break;
	  case "nb":	city = "Newport%20Beach"; break;
	  case "cdm":	city = "Corona%20Del%20Mar"; break;
	  default:	city = "";
	}

	// url = "http://www.searchpoint.net/list.asp?_account=idd&_ptype=1&property_type=RES&_trace=0&_lid=0&_wpid=1&_org_id=oc&_ver=5&_new=1&_per_id=4527F56CC0B94DDD989114FD7D0C1F1D&_agent_public_id=SLAMPCHR&_sponsor_org_id=oc&_agent_email=christine@ocvillas.com&_client_name=%20&_slog_type=1&_start=1&I:list_price:gte=" + low + "&I:list_price:lte=" + high + "&res_property_type=" + type + "&city_name=" + city + "&_hdnCityState=ca&_adv_srch=0&_measuring_system=E&_any_l=0&_any_f=0&_count=20&_search_no=&state=ca"; 
	url = "http://www.searchpoint.net/list.asp?_account=idd&_ptype=1&property_type=RES&_trace=0&_lid=0&_wpid=1&_org_id=casocal&_ver=5&_new=1&_agent_public_id=SLAMPCHR&_sponsor_org_id=CASOCAL&_agent_email=christine@ocvillas.com&_client_name=%20&_slog_type=1&_start=1&I:list_price:gte=" + low + "&I:list_price:lte=" + high + "&res_property_type=" + type + "&city_name=" + city + "&_hdnCityState=ca&_adv_srch=0&_measuring_system=E&_any_l=0&_any_f=0&_count=20&_search_no=&state=ca"; 
	popUp(url, "listingswin", w, h, 1);
}

<!-- http://www.searchpoint.net/list.asp?_account=idd&_ptype=1&property_type=RES&_trace=0&_lid=0&_wpid=1&_org_id=casocal&_ver=5&_new=1&_em=1&_per_id=4527F56CC0B94DDD989114FD7D0C1F1D&_agent_public_id=slampchr&_sponsor_org_id=CASOCAL&_agent_email=christine@ocvillas.com&_client_name=%20&_slog_type=1&_start=1&_notify_days_mask=127&I:list_price:gte=400000&I:list_price:lte=500000&res_property_type=TWN,CON,COO,COOP,OYO,TWNHS,CONDO,NSF&city_name=Laguna%20Niguel&_hdnCityState=ca&_adv_srch=0&_measuring_system=E&_any_l=0&_any_v=0&_any_f=0&_count=3&_search_no=91971&state=ca -->

// Popup city profile window
function viewCityProfile(city) {
	w = 592;
	h = 670;
	var url = "";

	switch (city) {
	  case "ln": 	url = "http://kw.moving.com/find_a_place/cityprofile/results.asp?Zip=92677"; break;
	  case "av": 	url = "http://kw.moving.com/find_a_place/cityprofile/results.asp?City=aliso+viejo&State=6&zip=92656&sbmtZIP=Get+Report"; break;
	  case "dp": 	url = "http://kw.moving.com/find_a_place/cityprofile/zip_selector.asp?State=6&City=dana%20point"; break;
	  case "sc": 	url = "http://kw.moving.com/find_a_place/cityprofile/zip_selector.asp?State=6&City=san%20clemente"; break;
	  case "sj": 	url = "http://kw.moving.com/find_a_place/cityprofile/zip_selector.asp?State=6&City=san%20juan%20capistrano"; break;
	  case "lb": 	url = "http://kw.moving.com/find_a_place/cityprofile/results.asp?Zip=92651"; break;
	  case "nc": 	url = "http://kw.moving.com/find_a_place/cityprofile/results.asp?Zip=92657"; break;
	  default: 	url = "http://kw.moving.com/find_a_place/cityprofile/";
	}

	popUp(url, "profilewin", w, h, 1);
}


function viewCommunityReport(citycode) {
	w = 660;
	h = 670;

	switch (citycode) {
	  case "ln":	city = "Laguna%20Niguel"; break;
	  case "lb":	city = "Laguna%20Beach"; break;
	  case "dp":	city = "Dana%20Point"; break;
	  case "av":	city = "Aliso%20Viejo"; break;
	  case "sc":	city = "San%20Clemente"; break;
	  case "nc":	city = "Newport%20Coast"; break;
	  case "nb":	city = "Newport%20Beach"; break;
	  case "cdm":	city = "Corona%20Del%20Mar"; break;
	  default:	city = "";
	}

	//Report by address
	//url = "http://www.rdesk.com/communityinfo/CommunityReports.aspx?allowprint=0&showrdesklook=0&showsparky=0&showreportheader=1&allowchangereport=1&showtoolbar=1&appname=VP&LoadedInRdesk=0&AllowSave=0&allowcompare=1&allowchangelocation=1&CSSFile=%2fwebpoint%2fclientsite%2fstyle%2fcommunity%2fNavy-Blue-and-Dark-Red.css&HistGuid=9632891F-988A-4155-B90F-C5CFA6A5B7BC";

	//City Report URL
	url = "http://www.rdesk.com/communityinfo/CommunityReports.aspx?allowprint=0&showrdesklook=0&showsparky=0&showreportheader=1&allowchangereport=1&showtoolbar=1&appname=VP&LoadedInRdesk=0&AllowSave=0&allowcompare=1&allowchangelocation=1&CSSFile=%2fwebpoint%2fclientsite%2fstyle%2fcommunity%2fNavy-Blue-and-Dark-Red.css&ReportName=Climate&street=&city=" + city + "&statecode=CA&zipcode=&censusblock=";
	popUp(url, "reportwin", w, h, 1);

}


// Popup city trend window
function viewCityTrend(city) {
	w = 823;
	h = 500;

	var url = "http://www.orangecoastvillas.com/trends.asp?ct=" + city;
	popUp(url, "trendwin", w, h, 0);

}

// Window popup
function popUp(page, name, w, h, scroll) { 
	//name = "foo";

	page = page.split(" ").join("%20");
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	//var resizable = false;
	winprop  = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=yes';
	winRef = window.open(page, name, winprop);
	winRef.focus();
 }


// Handles imported content in iframe
function frame_content (topic) {
  var content = '""';
  var topic = 1;

  switch (topic) {
    case 1 : content = '"http://kw.moving.com/Moving_and_Planning/MAP_Article/"'; break;
    case 11 : content = '"http://db.inman.com/inman/content/subscribers/inman/columnist.cfm?columnistid=bruss"'; break;
    case 12 : content = '"http://db.inman.com/inman/content/subscribers/inman/columnist.cfm?columnistid=hymer"'; break;
    default : content = '"content error"';
  }


  document.write(content);
//  return content; 
}



// Handles tract search results - test, not used for now
function search_listings (tract) {
  var listings = "";
  var tract = "CCV";

  switch (tract) {
    case "CCV" : listings = "http://www.searchpoint.net/list.asp?_account=idd&_sponsor_type=Agent&_account_id=oc_SLAMPCHR&_trace=0&_org_id=oc&_pType=1&_any_f=0&_any_l=0&state=ca&_slog_type=1&_measuring_system=E&_ver=5&_agent_email=christine@orangecoastvillas.com&_menusOrig=99&_adv_srch=1&property_type=RES&_per_id=4527F56CC0B94DDD989114FD7D0C1F1D&*tract_code*=ccv&_count=3&_lid=0&_wpid=1&_client_name=Christine%20Lampert&_new=1&_agent_public_id=SLAMPCHR&city_name=Laguna%20Niguel&_sponsor_org_id=oc&_start=1"; break;
    case "JA" : listings = "http://www.searchpoint.net/list.asp?_account=idd&_sponsor_type=Agent&_account_id=oc_SLAMPCHR&_trace=0&_org_id=oc&_pType=1&_any_f=0&_any_l=0&state=ca&_slog_type=1&_measuring_system=E&_ver=5&_agent_email=christine@orangecoastvillas.com&_menusOrig=99&_adv_srch=1&property_type=RES&_per_id=4527F56CC0B94DDD989114FD7D0C1F1D&*tract_code*=ja&_count=3&_lid=0&_wpid=1&_client_name=Christine%20Lampert&_new=1&_agent_public_id=SLAMPCHR&city_name=Laguna%20Niguel&_sponsor_org_id=oc&_start=1"; break;
    default : listings = "tract search error";
  }


  return listings;
}


