var contactMail = 'contact'+'@'+'showart-sh.com.cn';
var menu1 = new Image();
var menu2 = new Image();
var menu3 = new Image();
var menu4 = new Image();
var menu5 = new Image();
var menu6 = new Image();
menu1.src = "m1.jpg";
menu2.src = "m2.jpg";
menu3.src = "m3.jpg";
menu4.src = "m4.jpg";
menu5.src = "m5.jpg";
menu6.src = "m6.jpg";

function mailto()	{
	document.location.href =  "mailto:" + contactMail;
}

function mouseOver(num) {
	
}

function categoryName(num) {
    document.getElementById('familleTitre').src = 'famille' + num  + '.jpg';
	if(num==0) {var couleurFamille = "#000000";}
	else if(num==1) {var couleurFamille = "#000000";}
	else if(num==2) {var couleurFamille = "#000000";}
	else if(num==3) {var couleurFamille = "#000000";}
	else if(num==4) {var couleurFamille = "#000000";}
	else if(num==5) {var couleurFamille = "#000000";}
	else if(num==6) {var couleurFamille = "#000000";}
	else if(num==7) {var couleurFamille = "#000000";}
	if (document.all) {document.getElementById('famille').style.setAttribute('cssText','background-color:'+couleurFamille);} else {document.getElementById('famille').setAttribute('style','background-color:'+couleurFamille);}
}

function nextPicture(cat,pnum,type) {
	var booknum = 'book' + cat + "_" + pnum;
	document.getElementById(booknum).src = 'jobs/load.jpg';
	if (type[pnum][1] < type[pnum][2]) {type[pnum][1] = type[pnum][1] + 1; document.getElementById('bookTxt'+pnum).style.display = "block";} else {type[pnum][1] = 0; document.getElementById('bookTxt'+pnum).style.display = "none";};
	document.getElementById(booknum).src = 'jobs/' + type[pnum][0] + "" + type[pnum][1] + '.jpg';
	}

function createBooks(num) {
	var categorie = document.getElementById('category'+num);
    while(categorie.hasChildNodes()==true){
		categorie.removeChild();
    } 
	if (num==0) {return;}
	else if (num==1) {var selectedPortfolio = portfolioRetail; var selectedPortfolioTxt = portfolioRetailTxt;}
	else if (num==2) {var selectedPortfolio = portfolioInterior; var selectedPortfolioTxt = portfolioInteriorTxt;}
	else if (num==3) {var selectedPortfolio = portfolioGraphic; var selectedPortfolioTxt = portfolioGraphicTxt;}
	else if (num==4) {var selectedPortfolio = portfolioWeb; var selectedPortfolioTxt = portfolioWebTxt;}
	else if (num==6) {var selectedPortfolio = portfolioLogo; var selectedPortfolioTxt = portfolioLogoTxt;}
	else if (num==7) {var selectedPortfolio = portfolioArt; var selectedPortfolioTxt = portfolioArtTxt;}
	for(var i=1; i<selectedPortfolio.length; i++) {
			var newBook = document.createElement('div');
			newBook.setAttribute('class','books');
			newBook.innerHTML = '<br><a href="javascript:nextPicture(' + num + ',' + i + ','+selectedPortfolio[0][0]+');"><img src="jobs/' + selectedPortfolio[i][0] + '0.jpg" id="book' + num + '_' + i + '" border="0" width="600" height="360"></a>'; 
			categorie.appendChild(newBook);
			var newBookInfo = document.createElement('div');
			newBookInfo.setAttribute('class','bookInfo');
			newBookInfo.setAttribute('id','bookTxt'+i);
			if (document.all) {newBookInfo.style.setAttribute('cssText','width:600px; font-smooth: always; display: none;"');} else {newBookInfo.setAttribute('style','width:600px;font-smooth: always;; display: none;');};
			newBookInfo.innerHTML = '<br><h3>' + selectedPortfolioTxt[i][1] + '</h3>'; 
			categorie.appendChild(newBookInfo);
	}
	return;
}

function roll(imgName, onOrOff)
   {
   if (onOrOff == "on") {document.getElementById(imgName).src = imgName+".jpg";} else {document.getElementById(imgName).src = imgName + "_off.jpg";}
   }

function affiche(num) {	
	for (var i=0; i<8; i++) {
		var cat = document.getElementById("category"+i);
		if (i == num) {
			cat.style.display = "block";
			}
		else {
			cat.style.display = "none";
			}
	}
	getWidth();
	categoryName(num);
	createBooks(num);
}	   

function getWidth() {
    var x = 0;
	if (self.innerHeight) {x = self.innerWidth - 337;}
	else if (document.documentElement && document.documentElement.clientHeight) {x = document.documentElement.clientWidth - 320;}
	else if (document.body){x = document.body.clientWidth - 337;}
	if (document.all) {
		document.getElementById('infoCentre').style.setAttribute('cssText','width:'+x+'px;');
		document.getElementById('spacer').style.setAttribute('cssText','width:20px;');
		} 
	else {
		document.getElementById('infoCentre').setAttribute('style','width:'+x+'px;');
		document.getElementById('spacer').setAttribute('style','width:20px;');
		}
}
