// Global variables
var language = '<?php echo $_SESSION[language]; ?>';


var panel = new Array(3);
for (i = 0; i <= 3; i++) {
	panel[i] = new Array(3);
} 
var type = 'table';



function init() {
	for(row=0; row<3; row++) {
		for(col=0; col<3; col++) {
			panel[row][col] = 0;
		}
	}
}


var displayproducts = false;
function open_close_products(element){

					myelement = document.getElementById(element);
					if(myelement.style.display == 'none'){
						new Effect.BlindDown(myelement); 
						displayproducts = true;
					} else {
						if(displayproducts == false){
							new Effect.BlindDown(myelement); 
							displayproducts = true;
						} else {
							new Effect.BlindUp(myelement);
							displayproducts = false;
						}
						
					}
				}

var displaydesigners = false;
function open_close_designers(element){
					myelement = document.getElementById(element);
					if(myelement.style.display == 'none'){
						new Effect.BlindDown(myelement); 
						displaydesigners = true;
					} else {
						if(displaydesigners == false){
							new Effect.BlindDown(myelement); 
							displaydesigners = true;
						} else {
							new Effect.BlindUp(myelement);
							displaydesigners = false;
						}
						
					}
				}






function lock(row, col) {
	mydiv =	'lock'+row+col;
	mypicture = 'img'+row+col;
	if(panel[row][col] == 0) {
		panel[row][col] = 1;
		document.getElementById(mydiv).src = '/pictures/locked.gif';
		document.getElementById(mypicture).style.border = '2px solid black';
	} else {
		panel[row][col] = 0;
		document.getElementById(mydiv).src = '/pictures/unlocked.gif';
		document.getElementById(mypicture).style.border = '1px solid silver';
	}
}


function unlockall() {
	for(row=0; row<3; row++) {
		for(col=0; col<3; col++) {
			panel[row][col] = 0;
			document.getElementById('lock'+row+col).src = '/pictures/unlocked.gif';
			document.getElementById('img'+row+col).style.border = '1px solid silver';
		}
	}
}


function change() {

	mydiv = document.getElementById('detail_img');
	mydiv.src = '/pictures/couch.jpg';
}	



function checkform()
{
str = 'Du mangler at udfylde \n \n';
	if (document.contactform.name.value == "")
	{
		str += 'Navn \n \n';
		error = true;
	}
	if (document.contactform.email.value == "")
	{
		str += 'Email \n \n';
		error = true;
	}
	if (document.contactform.subject.value == "")
	{
		str += 'Subject \n \n';
		error = true;
	}
	if (document.contactform.comment.value == "")
	{
		str += 'Kommentar';
		error = true;
	}

	if(error) {alert(str); return false;}
	else {return true;}
}

function go(dest) {
window.location.href = dest
}

function change_dimension(value, id) {

	if(value == "0") {
	dkk = "???";
	usd = "???";
	eur = "???";
	}else {
	eur = value.substring(value.lastIndexOf(";") + 1, value.length);
	rest = value.substring(0, value.lastIndexOf(";"));
	dkk = rest.substring(0, rest.lastIndexOf(";"));
	usd = rest.substring(rest.lastIndexOf(";") + 1, rest.length);
	}
	hide = document.getElementById('dimension_price');
	hide.style.display = 'none';
	show = document.getElementById('dimension_price_ok');
	show.style.display = 'block';

	price_dkk = document.getElementById('dimension_price_dkk');
	price_dkk.innerHTML = dkk;

	//price_usd = document.getElementById('dimension_price_usd');
	//price_usd.innerHTML = usd;

	price_eur = document.getElementById('dimension_price_eur');
	price_eur.innerHTML = eur;

	setDimensionSession(id); //Findes i ajax.js
}

init();

function menuOver(position) {
	var td1 = document.getElementById(position + "_1");
	var td2 = document.getElementById(position + "_2");
	var link = document.getElementById(position + "_link");
	td1.style.backgroundColor = "#EFEFEF";
	td2.style.backgroundColor = "#EFEFEF";
	link.style.color = "#2A7F00";
}

function menuOut(position) {
	var td1 = document.getElementById(position + "_1");
	var td2 = document.getElementById(position + "_2");
	var link = document.getElementById(position + "_link");
	td1.style.backgroundColor = "#FFFFFF";
	td2.style.backgroundColor = "#FFFFFF";
	link.style.color = "#000000";
}