﻿function viewPhoto(strPath)	{
	window.open('assets/viewphoto.aspx?strPath=' + strPath, 'Viewver', 'width=780, height=500, scrollbars=yes, status=yes, resizable=yes')
}

function ResizePhotoViewer(window) {
	var img = document.getElementById('imgPhoto')
	var x = img.width + 50;
	var y = img.height + 150;
	
	if (screen.availWidth<x) { 
		x = screen.availWidth - 28; 
	}
	
	window.resizeTo(x,y);
}

function showEmail(strName, strDomain, strLinkText) {
	var strEmail = strName + '@' + strDomain;
	if (!strLinkText) {strLinkText = strEmail;}
	
	document.write('<a class="email" href="mailto:' + strEmail + '">' + strLinkText + '</a>');
}

function PlayFlash(src, cssclass)	{
	document.write("<object class=\"" + cssclass + "\" type=\"application/x-shockwave-flash\" data=\"" + src + "\">")
	document.write("<param name=\"movie\" value=\"" + src + "\" />")
	document.write("</object>") 
}

function HidePhoto()	{
	document.getElementById('largeimage').style.display='none';
}

function Enlarge(photoId)	{
	if (document.getElementById('largeimage').style.display=='block')	{
		document.getElementById('largeimage').style.display='none';
	}
	else	{
		document.getElementById('imglarge').src='assets/dbphoto.aspx?tablename=CE_News&ColNameData=FileData&ColNameSize=FileSize&ColNameId=cntNewsId&id=' + photoId + '&width=500';
		document.getElementById('largeimage').style.display='block';
	}
}

function Toggle(obj)	{
	if (document.getElementById(obj).style.display=='block')	{
		document.getElementById(obj).style.display='none';
	}
	else	{
		document.getElementById(obj).style.display='none';
		document.getElementById(obj).style.display='block';
	}
}

function ChangeCarImage(ctl, imgUrl)    {
    document.getElementById(ctl).src=imgUrl;
}

function WinLeft(w)  {
    var l = (screen.availWidth-w)/2;
}

function WinTop(h)  {
    var t = (screen.availHeight-h)/2;
}

function CarIntresse(RegNo)  {
    window.open('http://www.bytbil.com/carinfo.cgi?intresse=1&regno=' + RegNo + '&look=bmwsverige/af1', 'intresse_window', 'width=460,height=560,resize=no,screenX=92,screenY=0,top=92,left=0');
}

function CarTipsa(RegNo)  {
    window.open('http://www.bytbil.com/carinfo.cgi?regno=' + RegNo + '&look=bmwsverige/tipsa', 'tipsa', 'toolbar=no,directories=no,menubar=no,height=340,width=240,scrollbars=no,resizable=no,left=0 top=92');
}

function CarFinansiering(RegNo)  {
    window.open('http://www.bytbil.com/carinfo.cgi?finansiering=1&regno=' + RegNo + '&look=bmwsverige/af1', 'intresse_window', 'width=580,height=550,resize=no,screenX=150,screenY=200,top=150,left=200');
}

function CarKarta(SellerCode)  {
    window.open('http://map.bytbil.com/Default.aspx?dealercode=' + SellerCode, 'karta_window', 'width=775,height=600,resizable=yes,scrollbars=1,screenX=170,screenY=20,top=20,left=170');
}