// JavaScript Document

function uri(url) {
	var regExp = /^((\w+):\/\/\/?)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#;\|]+)?([;\|])?([^\?#]+)?\??([^#]+)?#?(\w*)/;
	var r = regExp.exec(url);
	if(!r) return null;
	return (typeof(r[8]) == 'undefined' ? "" : r[8]);
	/* this.url = this._getVal(r,0); this.protocol = this._getVal(r,2); this.username = this._getVal(r,4); this.password = this._getVal(r,5);
	this.host = this._getVal(r,6); this.port = this._getVal(r,7); this.pathname = this._getVal(r,8); this.urlparamseparator = this._getVal(r,9);
	this.urlparam = this._getVal(r,10); this.querystring = this._getVal(r,11); this.fragment = this._getVal(r,12); */
}




function openDiv(codi) {
	$("#"+codi).each(function () {
			if ($(this).css("display")=="none") {
				$(this).slideDown("slow");
			} else {
				$(this).slideUp("slow");
			}
	});
}

function estiloOn(which, estilo){
if (document.all||document.getElementById){
which.className= estilo;
}
}


function changeHash() {
	var jash = window.location.hash; 
		
	switch(jash) {
		case '#atril':
			jQuery('#accordion').accordion('activate', 0);
		break;
		case '#atrilmesa':
			jQuery('#accordion').accordion('activate', 1);
		break;
		case '#lampara':
			jQuery('#accordion').accordion('activate', 2);
		break;
		case '#pupitre':
			jQuery('#accordion').accordion('activate', 3);
		break;
		case '#complemento':
			jQuery('#accordion').accordion('activate', 5);
		break;
		case '#ProyectosEsp':
			jQuery('#accordion').accordion('activate', 6);
		break;
		case '#silla':
			jQuery('#accordion').accordion('activate', 4);
		break;
	}
}


var boxstore = new Object();
var uricodi = "";

function fontSize(nivell){

	switch (nivell) {
		case 0:
			$(document.body).css({'font-size' : '90%'});
		break;
		case 1:
			$(document.body).css({'font-size' : '100%'});
		break;
		case 2:
			$(document.body).css({'font-size' : '120%'});
		break;
	}

	boxstore.set("fontSize", nivell);

}



$(document).ready(function(){
	$("#btn_display").mouseover(function () {
		  $(this).css({'background-image' : 'url(/_gif/btn_display2.jpg)'});
		  $("#btn_ver_prod").css({'color' : '#fff'});
	}).mouseout(function () {
		  $(this).css({'background-image' : 'url(/_gif/btn_display.jpg)'});
		  $("#btn_ver_prod").css({'color' : '#253E28'});
	});
	
	$("#prevBtn").mouseover(function () {
		alert('wew');
		  $("#prevBtn a").css({'background-image' : 'url(/_gif/display/anterior2.jpg)'});
	}).mouseout(function () {
		  $("#prevBtn a").css({'background-image' : 'url(/_gif/display/anterior.jpg)'});
	});
	
	$("#nextBtn").mouseover(function () {
		  $("#nextBtn a").css({'background-image' : 'url(/_gif/display/siguiente2.jpg)'});
	}).mouseout(function () {
		  $("#nextBtn a").css({'background-image' : 'url(/_gif/display/siguiente.jpg)'});
	});
});



$(document).ready(function(){
						   
	boxstore = new Persist.Store('Minuja Text Size Status');
	uricodi=uri(document.location).substr(1).replace(/\//g,"__");
	
	$("#a1").click(function () { fontSize(0); });
	$("#a2").click(function () { fontSize(1); });
	$("#a3").click(function () { fontSize(2); });
	
	boxstore.get("fontSize", function(ok, val) {
		if (ok&&val) fontSize(parseInt(val));
	});
	
});

