function popImage(src){

window.open('/popup_image.php?src='+src,'popimage','height=480,width=640,left=100,top=100,resizable=no,scrollbars=no,toolbar=no,status=no');


}

function positionElements(){
	// set the position of various elements
	
	//language selector
	// positioning post size load is the easiest way of making
	// it stay put!
	tgt = document.getElementById('headerSuzukiLogo');
	pos = findPosX(tgt) - 542;
	document.getElementById('headerLanguageSelector').style.left=pos + 'px';
	document.getElementById('headerLanguageSelector').style.top='320px';

	//equalise the two columns
	leftColBot = findPosY(document.getElementById('marker_leftcol_bot'));
	leftColTop = findPosY(document.getElementById('marker_leftcol_top'));	
	rightColBot = findPosY(document.getElementById('marker_rightcol_bot'));
	rightColTop = findPosY(document.getElementById('marker_rightcol_top'));	
	
	leftHeight = leftColBot - leftColTop;
	rightHeight = rightColBot - rightColTop;


	if(leftColBot > rightColBot){
		document.getElementById('rightCol').style.height=leftHeight -75 + 'px';		
		bot = leftColBot + 20;
	} else {
		document.getElementById('leftCol').style.height=rightHeight + 75 + 'px';		
		bot = rightColBot + 20;
	}	

	

	//set the position of the footer div
	document.getElementById('footer').style.top=bot + 'px';
	document.getElementById('footer').style.left='0px';
	
	//position the trailing grey at the bottom of the site
	far_bot = findPosY(document.getElementById('marker_far_bottom'));
	pos = bot + 99;
	botheight = far_bot - bot -99;
	if(botheight > 1){
		document.getElementById('footer_subgrey').style.height=botheight + 'px';	
	}
	document.getElementById('footer_subgrey').style.top=pos + 'px';
	document.getElementById('footer_subgrey').style.left='0px';
	max = getMaxZIndex();
        document.getElementById("leftCol").style.zIndex=max + 10;
        document.getElementById("leftColHolder").style.zIndex=max + 20;
	document.getElementById("headerFooterHatch").style.zIndex=max -2;
	document.getElementById("headerLanguageSelector").style.zIndex=max +20;  	

}	

function getMaxZIndex(){
var allElems = document.getElementsByTagName?
document.getElementsByTagName("*"):
document.all; // or test for that too
var maxZIndex = 0;
for(var i=0;i<allElems.length;i++) {
var elem = allElems[i];
var cStyle = null;
if (elem.currentStyle) {cStyle = elem.currentStyle;}
else if (document.defaultView && document.defaultView.getComputedStyle) {
cStyle = document.defaultView.getComputedStyle(elem,"");
}
var sNum;
if (cStyle) {
sNum = Number(cStyle.zIndex);
} else {
sNum = Number(elem.style.zIndex);
}
if (!isNaN(sNum)) {
maxZIndex = Math.max(maxZIndex,sNum);
}
}
return maxZIndex;
}

function setOpacity(obj, opacity) {
opacity = (opacity == 100)?99.999:opacity;
// IE/Win
obj.style.filter = "alpha(opacity:"+opacity+")";
// Safari<1.2, Konqueror
obj.style.KHTMLOpacity = opacity/100;
// Older Mozilla and Firefox
obj.style.MozOpacity = opacity/100;
// Safari 1.2, newer Firefox and Mozilla, CSS3
obj.style.opacity = opacity/100;
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function emailmypasswd()
{
	document.getElementById("actionID").value="emailmypasswd";
       	document.logon.submit();
}

function show_stockcheck(){
        tgt = document.getElementById('alertbox-stockcheck');

        w = getWindowWidth();
        h = getWindowHeight();

        tgt.style.left= (w/2)-100 + 'px';
        tgt.style.top = (h/2)-70 + 'px';
}

function getWindowHeight(){
  var myHeight = 0;
  if( typeof( window.innerHeight ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
        return myHeight;
}

function getWindowWidth(){
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
        return myWidth;
}

