


function pop_up(pppurl,nm,wdth,hgt,lps,tps) {
    var features = ' " ' + 'toolbar=no, scrollbars=yes, resizable=yes, width='+ wdth + ', height=' +  hgt + ', left=' + lps+ ', top=' +tps+' " ' ;
    popupWin = window.open(pppurl,nm,features);
    popupWin.focus();
}

function pu(refno,make) {
     // url, title, width, height, left, top
	//alert(screen.availWidth + " x " + screen.availHeight)
	pop_up(refno + '-' + make + '.html','MTM',770,635,screen.availWidth-780,0)//screen.availWidth-50, screen.availHeight-730)
}
function puMore(url) {
    pop_up(url,'MTM',770,550,10,10)
}	

// new external pop up	
function pue(refno) {
	pop_up('popup.asp?callpage=externalbrokerlist&btsrefno=' + refno,'MTM',770,550,screen.availWidth-780,0)//screen.availWidth-50, screen.availHeight-730)
}
function puebl(refno) {
	pop_up('http://www.boatshop24.co.uk/popup.asp?callpage=externalbrokerlist&btsrefno=' + refno,'MTM',770,550,screen.availWidth-780,0)//screen.availWidth-50, screen.availHeight-730)
}

function viewAllBoatsBDP(btsbrokercode, encodedComp, target) {
	encodedComp = unescape(encodedComp)
	allBoatsUrl = "http://www.boatshop24.co.uk/" + encodedComp + "-" + btsbrokercode + "-advertlist.html"
	if (target == "_self") { 
		window.location = allBoatsUrl
	} else {
		newWindow = window.open(allBoatsUrl, "", "toolbar=yes, scrollbars=yes, resizable=yes, location=yes, menubar=yes, width=900, left=100")
	}
	//puMore("http://www.boatshop24.co.uk/brokerpage.asp?brokercode=<%=btsbrokercode%>")
	//window.close()
	return false
	
}
function pupgai01(refno) {
    pop_up('externalboatdetail-pgai01.asp?btsrefno=' + refno,'MTM',700,550,10,10)
}

function netscapepopup() {
    window.open('netscapepopup.asp','MTM','width=400,height=300')
}

function poster(actionpage) {
	document.currencyform.action = 'http://www.hifx.co.uk/'
	window.open("http://www.hifx.co.uk/")
}

function pop_upnoscroll(pppurl,nm,wdth,hgt,lps,tps) {
	var features = ' " ' + ' toolbar=no scrollbars=no resizable=no width = '+ wdth + ' height=' +  hgt + 'screenX = ' + lps+ 'screenY=' +tps+' " ' ;
	popupWin = window.open(pppurl,nm,features);
	popupWin.focus();
}

function pop_upCostCalc(currency,price) {
	popupWin = window.open('costcalculator.asp?currency=' + currency + '&price=' + price,'CostCalcPrice','width=250 height=365');
	popupWin.focus();
}
function basicpop(url,size) {
	popupWin = window.open(url,'popup',size);
	popupWin.focus();
}		

// position the pop up in the top right hand corner
function topRightPopUp(url, width, height) {
	left = screen.availWidth-(width+10)
	features = "'status=yes, scrollbars=yes, resizable=yes, width="+width+", height="+height+", left="+left+", top=0'"
	popupWin = window.open(url,'popup',features);
	popupWin.focus();
}
function popuphelp(make) {
    window.open('sponsoredlinkhelp.asp?make=' + make,'MTMFB','width=450,height=400')
}
    
var DealerName = "Marine Trader Media";
var LogoURL = "http://www.boatshop24.co.uk/images/index/top_01.gif";
function DN_LombardLink() {
    var strTemp = "";
    for (var i=0;i<(DealerName.length+1);i++)
    {
	strTemp += (DealerName.substring(i,i+1) == " ") ? "%20" : DealerName.substring(i,i+1);
    }
	DealerName = strTemp;
    var strURL = "http://www.lombard.co.uk/marine/default.asp"
    window.open(strURL  + "?CN=" + DealerName + "&URL=" + LogoURL);
}
function resizeMore() {
	window.resizeTo(780,700)
}

function trcPop(pppurl,wdth,hgt) {
    lps = screen.availWidth-(wdth+10);
	tps = 0;
	var features = ' " ' + 'toolbar=no, scrollbars=yes, status=yes, resizable=yes, width='+ wdth + ', height=' +  hgt + ', left=' + lps+ ', top=' +tps+' " ' ;
    popupWin = window.open(pppurl,'popup',features);
    popupWin.focus();
}

function sybPop(pppurl) {
	trcPop(pppurl,575,760)
	return false
}
	
function clearSearchForm()
	{
	document.qSearch.channel.selectedIndex = 0
	document.qSearch.manufacturer.selectedIndex = 0
	document.qSearch.neworused.selectedIndex = 0
	document.qSearch.keyword.value = ""
	document.qSearch.minprice.value = ""
	document.qSearch.maxprice.value = ""
	document.qSearch.minlength.value = ""
	document.qSearch.maxlength.value = ""
	document.qSearch.lengthunits.selectedIndex = 0
	document.qSearch.boatstoview.selectedIndex = 0
	document.qSearch.country.selectedIndex = 0
	currenciesDropdown = document.qSearch.curCurrency
	for (var i=0; i<currenciesDropdown.length; i++) 
		{
		if (currenciesDropdown[i].value=="GBP") 
		currenciesDropdown.selectedIndex = i 
		}
	}
	
function SearchSubmitter()
	{	
	allValid = true
	minprice = document.qSearch.minprice.value
	maxprice = document.qSearch.maxprice.value
	minlength = document.qSearch.minlength.value
	maxlength = document.qSearch.maxlength.value
	if (!isNaN(minprice) && !isNaN(maxprice) && minprice.length > 0 && maxprice.length > 0)
		{
		minprice = minprice * 1
		maxprice = maxprice * 1
		if (minprice > maxprice)
			{
			alert("The 'Minimum Price' must be smaller than the 'Maximum Price'")
			allValid = false
			return false
			}
		}
	if (!isNaN(minlength) && !isNaN(maxlength) && minlength.length > 0 && maxlength.length > 0)
		{
		minlength = minlength * 1
		maxlength = maxlength * 1
		if (minlength > maxlength)
			{
			alert("The 'Minimum Length' must be smaller than the 'Maximum Length'")
			allValid = false
			return false
			}
		}
	if (allValid)
		{
		document.qSearch.submit()
		}
	}
	
function contactBroker(type)
	{
		/*
	if (!window.opener.closed)
		{
		window.opener.location = 'popup.asp?btsrefno=<%=btsrefno%>&advertpage=' + type;
		window.opener.focus();
		return false;
		}
		*/
	}

function createFlashMarkup(width,height,uri,container,replaceid){

	var embed = document.createElement('embed');
	embed.setAttribute('width',width);
	embed.setAttribute('height',height);
	embed.setAttribute('src',uri);

	var div = document.getElementById(replaceid);
	document.getElementById(container).replaceChild(embed,div); 
}
