
var popup = {};
function doPopup(url, name, width, height, winparams) {
	if (!width) width = screen.availWidth;
	if (!height) height = screen.availHeight;
	if (!name) name = 'popup';
	if (!url) return;
	leftX = (screen.availWidth - width) / 2;
	topY = (screen.availHeight - height) / 2;
	if (leftX < 0) leftX = 0;
	if (topY < 0) topY = 0;
	if (window.opera) topY = 2 * topY / 3;
	if (!(name in popup) || popup[name].closed) {
		popup[name] = window.open(url, name, 'width=' + width + ',height=' + height +
				',left=' + leftX + ',top=' + topY + (winparams?','+winparams:''));
	}
	if (window.focus) popup[name].focus();
	if (popup[name].opener == null) popup[name].opener = self;
	return popup[name];
}
String.prototype.startsWith = function (s) {
	return this.substr(0, s.length) === s;
}
var no_prompt_needed = [
	"http://www.1fordracing.com",
	"http://f150svtraptor.com"
];
function launchExLink($url) {
	for (var i = 0; i < no_prompt_needed.length; ++i) {
		if ($url.startsWith(no_prompt_needed[i])) {
			//sendLinkEventNew('referral:exit', 'referral:'+$url);
			doPopup($url, 'article', 980, 738, 'scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes');
			return;
		}
	}
	if (confirm("You are linking to a non-Ford Web site. Your browsing and interaction are subject to the rules and policies of that site. Please read over the site's rules and policies before proceeding.")) {
		//sendLinkEventNew('referral:exit', 'referral:'+$url);
		doPopup($url, 'article', 750, 673, 'left=0,top=0,toolbar=yes,location=no,scrollbars=yes,status=no,resizable=yes,fullscreen=No');
	}
}
function extLink(dest)
{
	switch (dest){
	case 'signup':
		openNewWindow('/trucks/2008superduty/updates/', '', 'width=480, height=620,scrollbars=yes,resizable=no, menubar=no, toolbar=no, left=90, top=227');
		break;
	case 'tellafriend':
		openNewWindow('/thetruthabouttrucks/tellafriend/?intcmp=fv:tat:tellafriend', '', 'width=737, height=700,scrollbars=yes,resizable=yes, menubar=no, location=no,toolbar=no, left=90, top=50');
		break;
	case 'overview':
		openNewWindow('/trucks/superduty/', '', 'width=800,height=600,scrollbars=yes,resizable=yes, location=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'BuildAndPrice':
		openNewWindow('http://www.forddirect.fordvehicles.com/FordVehicles.jsp?target=config&partner=&sModel=2008superduty&sBrand=Ford&sZip=', '', 'width=800,height=600,scrollbars=yes,resizable=yes, location=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'GetAQuote':
		openNewWindow('http://www.forddirect.fordvehicles.com/FordVehicles.jsp?sZip=&partner=&sModel=2008superduty&sBrand=Ford&quickQuote=true', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
		
	case 'LocateADealer':
		openNewWindow('/dealerships/locate/', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'DealerInventory':
		openNewWindow('http://www.forddirect.fordvehicles.com/FordVehicles.jsp?target=Inventory&partner=&sModel=2008superduty&sBrand=Ford&sZip= ', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'ReqABrochure':
		openNewWindow('/trucks/superduty/brochures/', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'TradeInValue':
		openNewWindow('http://web1.intellipriceauto.com/EtradeinMatrix/identify.aspx?lcdealer=910001&spanish=NO', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;	
	case 'sitemap':
		openNewWindow('/help/sitemap', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'help':
		openNewWindow('/help', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'contact':
		openNewWindow('/help/contact', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'privacy':
		openNewWindow('/help/privacy', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'california':
		openNewWindow('/help/privacy/california', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
		break;
	case 'RevealPromo':
	    openNewWindow('http://www.driveatransitconnect.com', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
	break;
	case 'CommTruck':
	    openNewWindow('http://www.commtruck.ford.com/', '', 'width=800,height=600, location=yes,scrollbars=yes,resizable=yes, menubar=yes, toolbar=yes, left=90, top=227');
	break;
	case 'RequestInfo':
	    openNewWindow('https://secure.ngfv.fordvehicles.com/transitconnect/signup/?', '', 'width=665,height=650,location=no,scrollbars=yes,resizable=no, menubar=no, toolbar=no, left=90, top=227');
	break;
	case 'Schedule':
	    //openNewWindow('http://www.letfordrecycleyourride.com/?LeadSource=FordVehicles&AltLeadSource=CAC&AltLeadSourceId=transitconnect', '', 'width=800,height=650,location=no,scrollbars=yes,resizable=no, menubar=no, toolbar=no, left=90, top=227');
	    openNewWindow('http://www.driveatransitconnect.com', '', 'width=800,height=650,location=no,scrollbars=yes,resizable=no, menubar=no, toolbar=no, left=90, top=227');
	break;
	
		
	}
	
}
function redirectandclose(location)
{
//	alert(location);
	opener.location = location;
	self.close();
}
function signupEmail(email)
{
	openNewWindow('/trucks/2008superduty/updates/notify/?email='+email, '', 'width=343,height=542,scrollbars=no,resizable=no, menubar=no, toolbar=no, left=400, top=200');
}
function ViewWallpaper(strImageName, iImageWidth, iImageHeight) {
		
	window.open ('/asp/modules/2008superduty/wallpaper_pop.asp?ImageName=' + strImageName + '&ImageWidth=' + iImageWidth + '&ImageLength=' + iImageHeight ,'','width=' + iImageWidth - 100 + ',height= ' + iImageHeight -100 + ' ,scrollbars,top=0,left=0,');
}
function trackingFunction() {
    //this is just a dummy function so I don't get a javascript error
    done = 1;
}
