/**************************************************************************************
# Author:	Alexander Geilhaupt <alex@geilhaupt.de>
# Datei:	/js/jscripts.js
# Inhalt:	JavaScript
#
# Copyright (c) 2001 - 2009 by Alexander Geilhaupt
# All Rights reserved. Unauthorized copying is a violance against applicable laws.
# You are not allowed to remove this comment.
#
**************************************************************************************/
var xmlHttp = false;
var xmlHttpB = false;
var xmlHttpC = false;

try 
	{
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
	} 
catch(e) 
	{
    try 
		{
        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
    	} 
	catch(e) 
		{
		xmlHttp  = false;
		}
	}
	
try 
	{
    xmlHttpB  = new ActiveXObject("Msxml2.XMLHTTP");
	} 
catch(e) 
	{
    try 
		{
        xmlHttpB  = new ActiveXObject("Microsoft.XMLHTTP");
    	} 
	catch(e) 
		{
		xmlHttpB  = false;
		}
	}
	
try 
	{
    xmlHttpC  = new ActiveXObject("Msxml2.XMLHTTP");
	} 
catch(e) 
	{
    try 
		{
        xmlHttpC  = new ActiveXObject("Microsoft.XMLHTTP");
    	} 
	catch(e) 
		{
		xmlHttpC  = false;
		}
	}
	
if(!xmlHttp  && typeof XMLHttpRequest != 'undefined') 
	{
    xmlHttp = new XMLHttpRequest();
	}

if(!xmlHttpB  && typeof XMLHttpRequest != 'undefined') 
	{
    xmlHttpB = new XMLHttpRequest();
	}

if(!xmlHttpC  && typeof XMLHttpRequest != 'undefined') 
	{
    xmlHttpC = new XMLHttpRequest();
	}
	
function initModelList(makeId,contentDiv)
	{
	var page = "/GHCMS/includes/dbresults.php?qtype=models&makeId="+makeId;
	if(xmlHttp) 
		{
		xmlHttp.open('GET', page, true);
		xmlHttp.onreadystatechange = function () 
			{
			if (xmlHttp.readyState == 4) 
				{
				document.getElementById(contentDiv).innerHTML = xmlHttp.responseText;
				}
			};
		xmlHttp.send(null);
		}
	}
	
function parkCar(carId,contentDiv)
	{
	var page = "/GHCMS/includes/dbresults.php?qtype=parkCar&carId="+carId;
	if(xmlHttp) 
		{
		xmlHttp.open('GET', page, true);
		xmlHttp.onreadystatechange = function () 
			{
			if (xmlHttp.readyState == 4) 
				{
				document.getElementById(contentDiv).innerHTML = xmlHttp.responseText;
				}
			};
		xmlHttp.send(null);
		}
	}
	
	
function openWindow(site,frame,w,h,sb)
	{
	if(sb == 3)
		{
		sb = "yes,resizable=yes";
		w = screen.availWidth;
		h = screen.availHeight;
		}
	if(sb == 2)
		{
		sb = "yes,toolbar=yes,menubar=yes,resizable=yes,location=yes";
		}
	var topPosition = (screen.height / 2) - (h / 2);
	var leftPosition = (screen.width / 2) - (w / 2);
	if(sb == 1)
		{
		window.open(''+site+'',''+frame+'');
		}
	else
		{
		window.open(''+site+'',''+frame+'','width='+w+',height='+h+',scrollbars='+sb+',top='+topPosition+',left='+leftPosition+'');
		}
	}
