function menuFix(){

	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for(var i = 0; i < sfEls.length; i ++){

		sfEls[i].onmouseover = function(){
			this.className += (this.className.length > 0 ? " " : "") + "sfhover";
		}

		sfEls[i].onmousedown = function(){
			this.className += (this.className.length > 0 ? " " : "") + "sfhover";
		}

		sfEls[i].onmouseup = function(){
			this.className += (this.className.length > 0 ? " ": "") + "sfhover";
		}

		sfEls[i].onmouseout = function(){
			this.className = this.className.replace(new RegExp("( ?|^)sfhover\\b"),"");
		}
	}
}
window.onload = menuFix;

function DrawImage(ImgD , nMaxWidth , nMaxHeight){
	
	var nWidth , nHeight;
	var image = new Image(); 
	image.src = ImgD.src;
	
	nWidth = image.width;
	nHeight = image.height;
	
	if(nWidth <= nMaxWidth && nHeight <= nMaxHeight) return;
	
	switch(nWidth > nHeight){
		
		case true:
			
			ImgD.width = nMaxWidth;
			ImgD.height = (nHeight * nMaxWidth) / nWidth;
			
			break;
		
		case false:
			
			ImgD.height = nMaxHeight;
			ImgD.width = (nWidth * nMaxHeight) / nHeight;
			
			break;
			
	}
	
}