// JavaScript Document


function altStyleName(styleProp) {
	
	var p=styleProp.indexOf("-");
	var s=styleProp;
	
	if (p>0) {
		var l=styleProp.length;
		s=styleProp.substr(0,p)+styleProp.substr(p+1,1).toUpperCase()+styleProp.substr(p+2,l-(p+2));
	}
	
	return s;
	
}

function getStyle(o,styleProp)
{
//	var x = document.getElementById(el);
	var x=o;
	if (x.currentStyle)
		if (x.currentStyle[styleProp]!=undefined)
			var y = x.currentStyle[styleProp];
		else
			var y = x.currentStyle[altStyleName(styleProp)];
    else if (window.getComputedStyle) 
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	else
		if (x.style[styleProp]!=undefined)
			x.style[styleProp];
		else
			x.style[altStyleName(styleProp)];

	return y; 
}

function getStyleValue(o,styleProp)
{
//	var x = document.getElementById(el);
	var x=o;
	if (x.currentStyle)
		if (x.currentStyle[styleProp]!=undefined)
			var y = x.currentStyle[styleProp];
		else
			var y = x.currentStyle[altStyleName(styleProp)];
    else if (window.getComputedStyle) 
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	else
		if (x.style[styleProp]!=undefined)
			x.style[styleProp];
		else
			x.style[altStyleName(styleProp)];
		
	y=parseInt(y);
	if (isNaN(y)) { return 0; } else { return y; }
}

function imgOverZoom(o, zoom) {
	if (zoom%2) zoom++;
	var nW=o.width+zoom;
	var hO= Math.round((o.height / o.width)*nW-o.height);
	if (hO%2) hO++;
	var nH=o.height+hO;
	
	var ml=getStyleValue(o,"margin-left");
	var mr=getStyleValue(o,"margin-right");
	var mt=getStyleValue(o,"margin-top");
	var mb=getStyleValue(o,"margin-bottom");

	
	o.style.width=nW+"px";
	o.style.height=nH+"px";
	o.style.marginLeft=(ml+(zoom/-2))+"px";
	o.style.marginRight=(mr+(zoom/-2))+"px";
	o.style.marginTop=(mt+(hO/-2))+"px";
	o.style.marginBottom=(mb+(hO/-2))+"px";
	o.style.position="relative";
	o.zIndex="100";
	
	o.onmouseout=imgReset;
	//o.onmousedown=imgReset;
}
function imgReset(e) {
	if (!e) e=window.event;
	this.style.width="";
	this.style.height=""
	this.style.marginTop="";
	this.style.marginLeft="";
	this.style.marginRight="";
	this.style.marginBottom="";
	this.style.position="";
	this.zIndex="";

	this.onmouseout=null;
	this.onmousedown=null;
	
}


