
// used to write flash object code to circumvent IE flash activating problem
function writecode (htmlcode) {
      document.write(htmlcode);
}



function getHeight() {
  myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;

}

function getWidth() {
  myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  return myWidth;
}
// opens a window without navigation etc
function openClearWin(url, w, h)
{
	if (url != "")
	{
		if (parent.clearWin == null)
		{
			newWindow = window.open(url,'clearWin', 'width = 640, height =500, toolbar = no, resizable=no, scrollbars=no,left=20, top = 20');
			newWindow.focus();
		}
		else 
		{
			parent.clearWin.location.href = url;
			parent.clearWin.focus();
		}
	}
}


function openExtWin(url) {
	if (url != "")
	{
		if (parent.extResults == null)
		{
			newWindow = window.open(url,'extResults','width=800, height=650, toolbar=no, resizable=yes, scrollbars=yes,left=' + (getWidth()-840)/2 +' ,top=170');
			newWindow.focus();
		}
		else 
		{
			parent.extResults.location.href = url;
			parent.extResults.focus();
		}
	}
}



//resizes the Exterior window
function resizeExtWin(width, height)
	{
		this.window.resizeTo(width, height);
	}

// resets the exterior window size to the regular size
function resetExtWin()
	{
		this.window.resizeTo(800, 600);
	}

// opens a window with variable size and position 
//var varWin=0;
/*
function openVarWin(url, width, height, left, top, scr, res)
{
	if(parent.varWin == null) 
	{
	   	varWin = window.open(url, 'varWin', 'toolbar = no, scrollbar='+scr+',resizable='+res+', width='+width+',height='+height+',left='+left+', top='+top+'');
		varWin.focus();		
	}
	else
	{
		//parent.varWin.resizeTo(120,120);
		//parent.varWin.location.href = url;
		//parent.varWin.close();
		parent.varWin = null;
		varWin = window.open(url, 'varWin', 'toolbar = no, scrollable='+scr+',resizable='+res+', width='+width+',height='+height+',left='+left+', top='+top+'');
		varWin.focus();
	}
	
}
*/


function changePic(pic)
{
	document.display.src = pic;
}
// used to display the description of the content when mousovering the various sections (occasionen, etc)
function displayDescription(elementID)
{
	document.getElementById(elementID).style.display='block';
}

function hideDescription(elementID)
{
	document.getElementById(elementID).style.display='none';
}

//gets the name of the actual file
function getSelfFileName()
{
	return self.location.href;
}



// loads the content of uri into the window
function picWarning()
{
	alert("Bitte beachten Sie, dass das Bild vom Typ '.jpg' sein muss und maximal 30 KB haben darf \n  -- SONST WIRD DAS BILD IGNORIERT ! ---- \n Für beste Bildqualität Grösse = 320 x 240 pixel");
}


//changes picture and picture text on newCars page
function changePicAndText(pic, picText)
{
	document.display.src = pic;
	
	var textToSet = picText;
 	var rd_Start = 0;
 	var rd_Length = document.getElementById("textArea").firstChild.nodeValue.length;
 	document.getElementById("textArea").firstChild.replaceData(rd_Start,rd_Length,textToSet);
}

