if ('undefined'==typeof(jQuery)){
jQuery.noConflict();
}


///////////////////////////////////////
//
//	Generic onload by Brothercake
//	http://www.brothercake.com/
//
///////////////////////////////////////

//onload function
function generic(){
		//document.getElementById('product_parameters').style.display='none';
	}
	
//setup onload function
var undefined;




if(typeof window.addEventListener != 'undefined'){
	//.. gecko, safari, konqueror and standard
	window.addEventListener('load', generic, false);
	}
else if(typeof document.addEventListener != 'undefined'){
	//.. opera 7
	document.addEventListener('load', generic, false);
	}
else if(typeof window.attachEvent != 'undefined'){
	//.. win/ie
	window.attachEvent('onload', generic);
	}

//** remove this condition to degrade older browsers
else {
	//.. mac/ie5 and anything else that gets this far
	//if there's an existing onload function
	if(typeof window.onload == 'function'){
		//store it
		var existing = onload;
		
		//add new onload handler
		window.onload = function(){
		//call existing onload function
		existing();
		//call generic onload function
		generic();
		};
	}
	else{
		//setup onload function
		window.onload = generic;
	}
}
/////////////////////////////////////////

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

function cambiar_fabricante(){
	var form=document.mod_adv_marca;
	var fab=form.marca.value;
	if(fab!=''){		
		var url=form.url.value;
		var keyword=form.keyword.value;
		var cat=form.category_id.value;
		var extras=form.extras.value;
		if(cat!=""){
			cat='&category_id='+cat;
			//alert('with cat');
		}
		var itemid=form.itemid.value;
		url=url+'index.php?option=com_virtuemart&page=shop.browse'+cat+'&manufacturer_id='+fab+'&Itemid='+itemid;
		if(keyword!=""){
			url=url+'&keyword='+keyword;
		}
		document.location.href=url+extras; 
	}
}

function cambiar_categoria(){
	var form=document.mod_adv_cat;
	var url=form.categoria.value;
	if(url!=''){		
		/*var fab=form.manufacturer_id.value;
		var url=form.url.value;
		var keyword=form.keyword.value;
		var itemid=form.itemid.value;*/
		
		//url=cat;
		/*if(keyword!=""){
			url=url+'&keyword='+keyword;
		}
		if(fab!=""){
			url=url+'&manufacturer_id='+fab;
		}*/
		document.location.href=url;
	}
}
