var img_urls = new Array(
	"/img/navi1.gif",
	"/img/navi2.gif",
	"/img/navi3.gif",
	"/img/symbol_kontakt1.gif",
	"/img/symbol_kontakt2.gif",
	"/img/symbol_impressum1.gif",
	"/img/symbol_impressum2.gif",
	"/img/symbol_sitemap1.gif",
	"/img/symbol_sitemap2.gif",
	"/img/symbol_drucken1.gif",
	"/img/symbol_drucken2.gif",
	"/img/symbol_callback1.gif",
	"/img/symbol_callback2.gif",
	"/img/div/subnav_bot.gif",
	"/img/div/subnav_mid.gif",
	"/img/div/subnav_top.gif",
	"/img/div/bg_busse.gif",
	"/img/div/bg_events.gif",
	"/img/div/bg_fahrzeugmarkt.gif",
	"/img/div/bg_kontakt.gif",
	"/img/div/bg_marken.gif",
	"/img/div/bg_service.gif",
	"/img/div/bg_truck.gif",
	"/img/div/bg_tuning.gif",
	"/img/div/bg_unternehmen.gif"
);

var preload = new Array();

for(i = 0; i < img_urls.length; i++)
{
	preload[i] = new Image();
	preload[i].src = img_urls[i];
}


function changeSym(welches, nr)
{
	document.getElementById("sym_" + welches).src = "/img/symbol_" + welches + nr + ".gif";
}


function checkSearch()
{
	var result = true;
	if (document.forms['suche'].elements['searchvalue'].value == "" || document.forms['suche'].elements['searchvalue'].length < 3)
	{
		alert("Fehler! Ihr Suchbegriff muss mindestens 3 Zeichen lang sein.");
		document.forms['search'].elements['searchvalue'].focus();
		result = false;
	}
	return result;
}

function popup(url, width, height, name) {
		var appendix;
		if(url.indexOf('?') > 0) {
			appendix = '&';
		} else {
			appendix = '?';
		}
		if(url.indexOf('#') > 0) {
			url = url.substring(0, url.indexOf('#')) + appendix + 'popup=true' + url.substring(url.indexOf('#'));
		} else {
			url = url + appendix + 'popup=true';
		}
        var p = window.open(url, name, 'width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
		if (p)
			p.focus();
}

function popupRS(url, name, width, height)
{
	var appendix;
		if(url.indexOf('?') > 0) {
			appendix = '&';
		} else {
			appendix = '?';
		}
		if(url.indexOf('#') > 0) {
			url = url.substring(0, url.indexOf('#')) + appendix + 'popup=true' + url.substring(url.indexOf('#'));
		} else {
			url = url + appendix + 'popup=true';
		}
	p = window.open(url, name, 'dependent=yes,width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
	if (p)
	{
		p.focus();
	}
}

function popupRS2(url, width, height, name) {
		var appendix;
		if(url.indexOf('?') > 0) {
			appendix = '&';
		} else {
			appendix = '?';
		}
		if(url.indexOf('#') > 0) {
			url = url.substring(0, url.indexOf('#')) + appendix + 'popup=true' + url.substring(url.indexOf('#'));
		} else {
			url = url + appendix + 'popup=true';
		}
        p = window.open(url, name, 'width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1');
		if (p)
			p.focus();
}


function popupPrint(url, name, width, height)
{
	pr = window.open(url, name, 'width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=1,scrollBars=1,resizable=1');
	if (pr)
	{
		pr.focus();
	}
}


function openImg(url, img, width, height)
{
	var height = (height+30);
	p = window.open(url+"?img="+img, 'Grosansicht', 'dependent=yes,width='+width+',height='+height+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0');
	if (p)
	{
		p.focus();
	}
}


function gw_popup(url)
{
	var width = (screen.width<1024) ? 800 : 1024;
	var height = (screen.height<768) ? 600 : 768;
	p = window.open(url,'kunzmann_cars','width='+width+',height='+height+',location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
	if (p)
	{
		p.focus();
	}
}

function print_view(url) {

	var width = (screen.width<1024) ? 800 : 1024;
	var height = (screen.height<768) ? 600 : 768;
	pv = window.open(url,'kunzmann_cars_print_view','width='+width+',height='+height+',location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');
	if (pv)
		pv.focus();

}

/*Event.observe(window, 'load', function() {
	Event.observe(document, 'click', function(event) {
		var element = Event.findElement(event, 'A');
		if(element != document && element.host == document.location.host) {
			Event.stop(event);
			new Ajax.Request(element.href, {
				onSuccess: function(transport) {
					$('maindiv').innerHTML = transport.responseText;
				}
			});
		}
	});
});*/



function popup2(obj,w,h) 
{ 
 
 var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href; if (!url) return true; 
 w = (w) ? w += 20 : 150; 
// 150px*150px is the default size 
h = (h) ? h += 25 : 150; 
var args = 'width='+w+',height='+h+',resizable';


 pop = window.open(url,'',args);
  return (pop) ? false : true; 
 }
   
