 /**
* Menu & Sidebar functions
*
*/


/**
* $this - Returns a correct element(addClassName, ...)
*
* @param t - this-reference
*/
function $this(t){
	if(!t.id)
		t.id="id"+Math.round(Math.random()*10000000);
	return $(t.id);
}


/* ##################################### SmartAssistant 2.0 ############################################### */



/* ####################### Page Selector ########################### */

/**
* showDropdown - Will be called after menu mouseover
*
* @param t - this-reference
*/
function showDropdown(t) {
	$this(t).addClassName("hover");
}

/**
* hideDropdown - Will be called after menu mouseout
*
* @param t - this-reference
*/
function hideDropdown(t) {
	$this(t).removeClassName("hover");
}
/* ####################### Page Navigation ########################### */
function tabsubmit(x) {
	document.form1.gotoTab.value = x;
	document.form1.submit();
}

function gotoPage(page, baseURL) {
	document.consresult.action=baseURL;
	document.getElementById('ranking_page_index').value=page;
	document.consresult.target='_self';
	document.consresult.submit();
	return false;
}

/* ####################### IntermediateResult ########################### */

function showProductInfo(id){
	if(navigator.userAgent && $('intermediateresults_result')!= null);
		$('intermediateresults_result').style.opacity=1;
		
	$(id).style.display='block';
}
function hideProductInfo(id){
	$(id).style.display='none';
}
/**
* Click on product image or product info
* Marking & Selecting
*
* @param t reference - reference to improduct
* @param toggleSelection boolean - toggle checkbox selection to handle outside clicks
*/
function selectProduct(id,toggleSelection){

	toggleSelection = (selectProduct.arguments.length == 1)?true:toggleSelection;

	var chb = $$("#"+id+" input, input#"+id+"")[0];
	
	if(toggleSelection)
		chb.checked = (chb.checked == true) ? false: true;
	
	
	
	if(chb.checked)
		$(id).addClassName("marked");
	else
		$(id).removeClassName("marked");
	
	/*
	if($$("body.resultButtonFade").length > 0){
		if($$("#intermediateresults_result .marked").length > 0){
			backgroundFade($("compareInfo"),'compareInfoActive');
		}else{
			backgroundFade($("compareInfo"),'compareInfoInactive');
		}
	}*/
}

