function LinkTo(cat,url,Make,Model,RegPlate,Price,UniqueId,Comment,Groupid,Dealerid,Dealername,DealerRef) 
{
	var width='';
	var height='';
		var sizes=url.substring(url.indexOf('POP_SIZE=')+9,url.length);
	if(url.indexOf('POP_SIZE=') >-1)  
	{
		width=sizes.substring(0,sizes.indexOf('*'));
		height=sizes.substring(sizes.indexOf('*')+1);
	}
	if (width =="" || width == null) width =520;
	if (height == "" || height == null) height =480;
		pop_up(url, '',width,height);
}

function pop_up(URL,popName,Width,Height) 
{
	if (Width =="" || Width == null) Width =486;
	if (Height == "" || Height == null) Height =500;

	var features =
	',directories=0'+
	',location=0'   +
	',menubar=0'   +
	',scrollbars=1'+
	',status=0'   +
	',toolbar=0'   +
	',resizable=1' +
	',width=' + Width +
	',height=' + Height +
	',screenX=15' +
	',screenY=15' +
	',top=15'+
	',left=15';
	URL = URL.replace(/\s/,'%20');
	wind=window.open (URL, popName, features);
	wind.focus();
}


function pop_up_ks_large_image()
{
    var index = 0;
    while(index < largeIds.length)
    {
        var entry = largeIds[index];
        if(entry.indexOf('[' + id + ']') > 0)
        {
            var foundId = entry.substr(0,entry.indexOf('[' + id + ']'));
            var features =	',directories=0' +
             				',location=0' +
             				',menubar=0' +
             				',scrollbars=0' +
             				',status=0' +
	         				',toolbar=0' +
             				',resizable=1' +
             				',width=460' +
             				',height=400' +
    	     				',screenX=15' +
				            ',screenY=500' +
             				',top=15' +
             				',left=550';
		    var large_image = window.open( ks_large_url + foundId, "LargeImage", features );
			large_image.focus();
			index = largeIds.length;
        }
		index++;
	}
}


function change_parent(URL)  
{
	if (window.opener && !window.opener.closed)  
	{
		window.opener.location=URL;
		window.opener.focus();
	}
	else 
	{
		window.open(URL, 'NEW');
	}
}

function pop_up_sales_lead( url, id, manufacturer, model )
{
    url = url + "?id=" + id + "&manufacturer=" + manufacturer + "&model=" + model + "&new=yes";
    var features = ',directories=0' +
                   ',location=0' +
                   ',menubar=0' +
                   ',scrollbars=1' +
                   ',status=0' +
                   ',toolbar=0' +
                   ',resizable=1' +
                   ',width=486' +
                   ',height=635' +
                   ',screenX=15' +
                   ',screenY=15' +
                   ',top=15' +
                   ',left=15';
    var new_car = window.open( url, "SalesLead", features );
    new_car.focus();
}


function multiple_pop_up_large_image()
{
    var index = 0;
    while(index < largeIds.length)
    {
        var entry = largeIds[index];
        if(entry.indexOf('[' + id + ']') > 0)
        {
            var foundId = entry.substr(0,entry.indexOf('[' + id + ']'));
            var features = ',directories=0' +
                           ',location=0' +
                           ',menubar=0' +
                           ',scrollbars=0' +
                           ',status=0' +
                           ',toolbar=0' +
                           ',resizable=1' +
                           ',width=680' +
                           ',height=525' +
                           ',screenX=15' +
                           ',screenY=550' +
                           ',top=15' +
                           ',left=550';
            var large_image = window.open( large_url + foundId, "LargeImage", features );
            large_image.focus();
            index = largeIds.length;
        }
        index++;
    }
}


function pop_up_large_image()
{
    var index = 0;
    while(index < largeIds.length)
    {
        var entry = largeIds[index];
        if(entry.indexOf('[' + id + ']') > 0)
        {
            var foundId = entry.substr(0,entry.indexOf('[' + id + ']'));
            var features = ',directories=0' +
                           ',location=0' +
                           ',menubar=0' +
                           ',scrollbars=0' +
                           ',status=0' +
                           ',toolbar=0' +
                           ',resizable=1' +
                           ',width=680' +
                           ',height=535' +
                           ',screenX=15' +
                           ',screenY=550' +
                           ',top=15' +
                           ',left=550';
            var large_image = window.open( large_url + foundId, "LargeImage", features );
            large_image.focus();
            index = largeIds.length;
        }
        index++;
    }
}

function printWindow()
{
    if (window.print)
    {
        window.print();
    }
}

function swapImage(image,id_)
{
    document.master.src = image;
    id = id_;
    hide();
}

function hide()
{var index = 0;
   var unset = true;
   while(index < largeIds.length)
   {var entry = largeIds[index];
       if(entry.indexOf('[' + id + ']') > 0)
       {
        document.getElementById('largeLink').style.visibility = "visible";
        document.getElementById('noLargeLink').style.visibility = "hidden";
        unset = false;
       }
        index++;
   }
   if(unset)
   {
    document.getElementById('largeLink').style.visibility = "hidden";
    document.getElementById('noLargeLink').style.visibility = "visible";
   }
}

function checkAnchor(anchor)
{
    var index = 0;
    var unset = true;
    while(index < largeIds.length)
    {
        var entry = largeIds[index];
        if(entry.indexOf('[' + id + ']') > 0)
        {
            anchor.style.cursor = "pointer";
            unset = false;
        }
        index++;
    }
    if(unset)
    {
        anchor.style.cursor = "default";
    }
}

function checkAnchorZoom(anchor)
{
    var index = 0;
    var unset = true;
    while(index < largeIds.length)
    {
        var entry = largeIds[index];
        if(entry.indexOf('[' + id + ']') > 0)
        {
            anchor.style.cursor = "url(images/magniglass.cur)";
            unset = false;
        }
        index++;
    }
    if(unset)
    {
        anchor.style.cursor = "default";
    }
}
