// Dart Random Number
_krdDartOrd = new Date().getTime();

//  Dart Tile Number 1-16 unique in page by inc 1
_krdDartInc = 0;

// Dart Random Number
_phDartOrd = new Date().getTime();

//This is needed for prospero comments and possibly other partners
var krd_site = "philly";
var krd_site_display_name = "Philly.com";
var krd_publication = "philly";
var krd_topix_property = "5008";

var navReady = false;
var toolsReady = false;
var partner_group = "";

// This is the search box javascript 

function searchFormSubmit(form) {
		if(form.searchKeywords.value == "")
		{
		alert('You must enter a search phrase');
		return false;
		}
		if (form.searchSelect[1].checked == true) {
		window.location = "http://www.newslibrary.com/nlsearch.asp?search_mode=basic&action=search&sort=d%3Ah&nitems=10&region=pi&dbquery=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[2].checked == true) {
		window.location = "http://www.google.com/search?client=pub-0263138902125618&forid=1&safe=active&hl=en&q=" + form.searchKeywords.value;
		return false;
		}
		return true;
		}

// New search box javascript for drop down menu

function searchFormSubmit1(form) {
		if(form.searchKeywords.value == "")
		{
		alert('You must enter a search phrase');
		return false;
		}
		if (form.searchSelect[1].selected == true) {
		window.location = "http://www.newslibrary.com/nlsearch.asp?search_mode=basic&action=search&sort=d%3Ah&nitems=10&region=pi&dbquery=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[9].selected == true) {
		window.location = "http://www.google.com/search?client=pub-0263138902125618&forid=1&safe=active&hl=en&q=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[4].selected == true) {
		window.location = "http://phillymarketplace.livedeal.com/search?zip=19101&kbid=3148&query=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[5].selected == true) {
		window.location = "http://www.phillycars.com/SearchResults.asp?NewOrUsed=1&ZipCode=19101&Radius=25&ByKeyWords=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[7].selected == true) {
		window.location = "http://www.phillyforsale.com/sales_results/SearchResults.asp?RoS=S&SqFoot=0&Acreage=0&CType=A&CountyIds=10,11,12,13,14,15,16,17,18,19,20,21,22,23,24&NewListings=0&PageSize=10&RegionIdCount=0&RegionIds=10,11,12,13,14,15,16,17,18,19,20,21,22,23,24&ReportSection=S&WebSearches=Y&CountyName=All_Atlantic-All_Bucks-All_Burlington-All_Camden-All_CapeMay-All_Chester-All_Cumberland-All_Delaware-All_Gloucester-All_Kent-All_Mercer-All_Montgomery-All_NewCastle-All_Ocean-All_Philadelphia-All_Salem-All_Sussex-All_OtherStates-All_OtherAreas&RegionName=All_Atlantic-All_Bucks-All_Burlington-All_Camden-All_CapeMay-All_Chester-All_Cumberland-All_Delaware-All_Gloucester-All_Kent-All_Mercer-All_Montgomery-All_NewCastle-All_Ocean-All_Philadelphia&KeyWord=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[8].selected == true) {
		window.location = "http://www.phillyforrent.com/rentals_results/SearchResults.asp?RoS=R&SqFoot=0&Acreage=0&CType=A&CountyIds=10,11,12,13,14,15,16,17,18,19,20,21,22,23,24&NewListings=0&PageSize=10&RegionIdCount=0&RegionIds=10,11,12,13,14,15,16,17,18,19,20,21,22,23,24&ReportSection=S&WebSearches=Y&CountyName=All_Atlantic-All_Bucks-All_Burlington-All_Camden-All_CapeMay-All_Chester-All_Cumberland-All_Delaware-All_Gloucester-All_Kent-All_Mercer-All_Montgomery-All_NewCastle-All_Ocean-All_Philadelphia-All_Salem-All_Sussex-All_OtherStates-All_OtherAreas&RegionName=All_Atlantic-All_Bucks-All_Burlington-All_Camden-All_CapeMay-All_Chester-All_Cumberland-All_Delaware-All_Gloucester-All_Kent-All_Mercer-All_Montgomery-All_NewCastle-All_Ocean-All_Philadelphia&KeyWord=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[6].selected == true) {
		window.location = "http://philly.monster.com/jobsearch.asp?col=dltc&ct=na&lid=585,374,532,533,581,29332,703&sort=dt&vw=b&keyw=" + form.searchKeywords.value + "&q=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[3].selected == true) {
		window.location = "http://www.philly.com/philly/restaurants/search?search=y&searchKeywords=" + form.searchKeywords.value;
		return false;
		}
		if (form.searchSelect[2].selected == true) {
		window.location = "http://www.philly.com/philly/entertainment/movies/search?search=y&searchKeywords=" + form.searchKeywords.value;
		return false;
		}

		return true;
		}



function getSite(){
	foundSite = false;
    site=document.location.hostname;
    endPos=site.indexOf(".com");
    if (endPos >= 1) {
		foundSite = true;
		site = site.substr(0, endPos);
		startPos = site.lastIndexOf(".");
		site = site.substr(startPos + 1);
	}
	return site;
}
function getPublication(){
	publication=document.location.pathname;
	startPos=publication.indexOf("/mld/");
	publication=publication.substr(startPos+5);
	endPos=publication.indexOf("/");
	publication=publication.substr(0,endPos);
	return publication;
}
function openSlideshow(url,width,height) {
	y=Math.floor((screen.availHeight-height)/2);
	x=Math.floor((screen.width-width)/2);
	window.open(url,'slideshow','width='+width+',height='+height+',top='+y+',left='+x+',scrollbars=yes,resizable=yes').focus();
}
function openWin(URL,WIDTH,HEIGHT) {
	if (typeof WIDTH == 'undefined') {
		WIDTH = 500;
	}
	if (typeof HEIGHT == 'undefined') {
		HEIGHT = 400;
	}
	WIDTH = WIDTH + 200;
	HEIGHT = HEIGHT + 250;

	var Win_Param = 'width='+WIDTH+',height='+HEIGHT+',resizable=yes,scrollbars=yes';
	aWindow = window.open(URL,'thewindow',Win_Param);
}

// Check environment.
function isTestEnv() {
  testHost = document.location.host;
  if (testHost == "" || testHost.match(/(\.(int|qa|stg)\.|localhost)/)) {
    return true;
  }
  return false;
}

var _isTestEnv = isTestEnv();

// Relative URLs
function relPath(path) {

p=document.location.pathname;document.location=p.substring(0,(i=5+p.substring(5).indexOf('/'))>4?i:p.length)+'/'+path;

}

//---------------- END GLOBAL.JS

