function drawimage(ImgD,FitWidth,FitHeight)
{
	var image=new Image();
	image.src=ImgD.src;
	if(image.width > 0 && image.height > 0)
	{
		if(image.width/image.height>= FitWidth/FitHeight)
		{
			if(image.width > FitWidth)
			{
				ImgD.width=FitWidth;
				ImgD.height=(image.height*FitWidth)/image.width;
			}
			else
			{
				//ImgD.width=image.width;
				//ImgD.height=image.height;
				ImgD.width=FitWidth;
				//ImgD.height=FitHeight;
			}
		} 
		else
		{
			if(image.height>FitHeight)
			{
				ImgD.height=FitHeight;
				ImgD.width=(image.width*FitHeight)/image.height;
			}else
			{
				//ImgD.width=image.width;
				//ImgD.height=image.height;
				//ImgD.width=FitWidth;
				ImgD.height=FitHeight;
			}
		}
	}
}

// Smooth Scroll Back to Top
var scrollToTop = function(){ $('a[@href=#top]').click(function(){ backToTop(); return false;} ) };
function backToTop() {
    var x1 = x2 = x3 = 0;
    var y1 = y2 = y3 = 0;

    if (document.documentElement) {
        x1 = document.documentElement.scrollLeft || 0;
        y1 = document.documentElement.scrollTop || 0;
    }

    if (document.body) {
        x2 = document.body.scrollLeft || 0;
        y2 = document.body.scrollTop || 0;
    }

    x3 = window.scrollX || 0;
    y3 = window.scrollY || 0;

    var x = Math.max(x1, Math.max(x2, x3));
    var y = Math.max(y1, Math.max(y2, y3));

    window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));

    if (x > 0 || y > 0) {
        window.setTimeout("backToTop()", 30);
    }
}


function getobject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId);
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId);
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} 

function turn(n,count){
	for(i=1;i<=count;i++){
		if(n==i){
			getobject('lm1_'+i).className="now"
			getobject('content1_'+i).style.display=""
		}else{
			getobject('lm1_'+i).className=""
			getobject('content1_'+i).style.display="none"
		}
	}
} 