/************************************************************/
function $(x){
	return document.getElementById(x)
}
/************************************************************/
var ie=document.all;
var nn6=document.getElementById&&!document.all;
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}
function set_products_height(){
	if((getPageSize()[1])>($('mainPart').offsetHeight + 20)){
		//$('mainPart').style.height = (getPageSize()[1] - 62)+"px"
		$('content_wrapper').style.height = (getPageSize()[1] - 200)+"px"
	}
}
/**************************************************************************/	
function equalSizes(){
	var allimages=document.getElementsByTagName("*");
	for (var x=0;x<allimages.length;x++){		
		var equalHeightTo=allimages[x].getAttribute('equalHeightTo');			
		if (equalHeightTo!=null){	
		// check to see if the image should equal its height to a certain div				
			var heightPadding=allimages[x].getAttribute('equalHeightPadding');			
			if (heightPadding){
				heightPadding=parseInt(heightPadding)
			}else{
				heightPadding=0;	
			}	
			var theNewHeight = Math.abs((document.getElementById(equalHeightTo).offsetHeight)+heightPadding)
			allimages[x].style.height=theNewHeight +'px';												
		}
		var equalWidthTo=allimages[x].getAttribute('equalWidthTo');			
		if (equalWidthTo!=null){				
		// check to see if the image should equal its height to a certain div				
			var widthPadding=allimages[x].getAttribute('equalWidthPadding');			
			if (widthPadding)
				widthPadding=parseInt(widthPadding)
			else
				widthPadding=0;		
			var theNewWidth = Math.abs(document.getElementById(equalWidthTo).offsetWidth+widthPadding)	
			allimages[x].style.width=theNewWidth +'px';												
		}
	}		
}
/* fix IE VS. FIREFOX bug in list view */
document.write('<style>');
if(ie){
	document.write('.list_padd li{padding:0;}');
	document.write('.academy_bottom_recommend div li{padding:0;}');
}else{
	document.write('.list_padd li{padding:0;padding-right:10px;}');
	document.write('.academy_bottom_recommend div li{padding:0;padding-right:10px;}');
}
document.write('</style>');


function toggle_me(idx){
	if($(Element.ancestors(idx)[1]).match('.menu_line')){
		Element.toggleClassName((Element.ancestors(idx)[1]), 'menu_line_open')
	}else{
		Element.toggleClassName((Element.ancestors(idx)[1]), 'menu_line')
	}
}