function menufunc(menuId)
{
	if(document.getElementById(menuId).style.display == "none")
	{
		startmenu();
		document.getElementById(menuId).style.display = "block";
	}
	else
	{
		startmenu();
	}
}




function EAGallery(cp,pa) {

	this.currentPic	= cp;
	this.picamount	= pa;
	this.highlight		= new Array("#C64934","#e0e0e0");
	this.slideshow	= 0;
	this.speed			= 5000;
		
	// Gallery Methods
	//this.picj		= picj;
	this.firstPic		= firstPic;
	this.lastPic		= lastPic;
	this.nextPic		= nextPic;
	this.previousPic = previousPic;
	this.showPic		= showPic;
	this.mark			= mark;
	this.startSls		= startSls;
	this.stopSls		= stopSls;
	this.slowerSls	= slowerSls;
	this.fasterSls		= fasterSls;
	
}

function mark(p,c){
	var e = document.getElementById(p);
    e.style.borderColor = this.highlight[c];
}

function firstPic(){
	this.currentPic = 1;
	this.showPic();
}

function lastPic(){
	this.currentPic = this.picamount;
	this.showPic();
}

function previousPic(){
	if(this.currentPic == 1){
		alert("First picture reached!");
	}
	else{
		this.currentPic = this.currentPic -1;
		this.showPic();
	}
}

function nextPic(picj){
	if(gl.slideshow == 0){
		if(this.currentPic == this.picamount){
			alert("Last picture reached!");
		}
		else{
			this.currentPic = this.currentPic +1;
			this.showPic(picj);
		}
	}
	else{
		if(gl.currentPic == gl.picamount){
			gl.currentPic = 1;
		}
		else{
			gl.currentPic = gl.currentPic +1;
		}
		sp = gl.speed;			
		setTimeout("showPic(picj)",sp);
	}
}

function startSls(){
	this.slideshow = 1;
	this.showPic();
}

function stopSls(){
	this.slideshow = 0;
}

function slowerSls(){
	if(this.speed < 10000) {
    	this.speed	+= 1000;
    }
    else{
    	alert("Slowest Speed Reached!");
    }
}

function fasterSls(){
	if(this.speed > 1000) {
    	this.speed	-= 1000;
    }
    else{
    	alert("Fastest speed reached!");
    } 
}

function showPic(picj,glj,j,product_id,sub_id,price,name){
	var j;
	var name;
	var price;
	var sub_id;
	var product_id;
	var img = eval('document.images[\'eaimage\'+j]');
	var hidden = eval('document.basketForm.show_id_'+product_id);
		hidden.value = sub_id;
	var input_name = eval('document.basketForm.name_'+product_id);
		input_name.value = name;
	var input = eval('document.basketForm.price_'+product_id);
		input.value = price;
	if(glj.slideshow == 0){
		nr = this.currentPic;
		img.src = picj[nr].picpath + picj[nr].name + picj[nr].type;
	}
	else{
		nr = glj.currentPic;
		img.src = picj[nr].picpath + picj[nr].name + picj[nr].type;
		glj.nextPic(picj);
	}
}

function EAImage(pp,t,d,fn,tp,alt) {			
    this.picpath		= pp;
    this.title			= t;
    this.description		= d;
    this.name 			= fn;
    this.type			= tp;		
    this.alt			= alt;		
}



