
function findportfolio(whcproj,timg){

pdiv = projectid[timg];
pdivimg = "i"+projectid[timg];

prjdivtxt = document.getElementById("portfoliotitle");
prjdiv = document.getElementById(pdiv);
prjdivimg = document.getElementById(pdivimg);


	if(whcproj == "0")
	{
		prjdivtxt.innerHTML = '';
		prjdiv.className = "portfoliothumb";
		prjdivimg.src = projectimg[timg];
		prjdivimg.width = "230";
		prjdivimg.height = "163";
	}
	else if(whcproj == "1")
	{
		prjdivtxt.innerHTML = '<h3>'+projecttxt[timg]+'</h3><span>Click for more information</span>';
		prjdiv.className = "portfoliothumblrg";
		prjdivimg.src = projectimgl[timg];
		prjdivimg.width = "260";
		prjdivimg.height = "184";
	}

}




function chgfashion(){

himg001 = new Image(535,354);
himg001.src ="/gfx/fashion_design.png";
himg002 = new Image(535,354);
himg002.src ="/gfx/contour_fashion_design.png";
himg003 = new Image(535,354);
himg003.src ="/gfx/fashion_contour_fashion_design.png";

fimg = document.getElementById("homefashionimg");

myimage = new Array(2);

myimage[0] = "/gfx/fashion_design.png";
myimage[1] = "/gfx/contour_fashion_design.png";
myimage[2] = "/gfx/fashion_contour_fashion_design.png";

rdn = Math.floor(Math.random()*3);

fimg.src = myimage[rdn];



}



/** To validate forms before submit **/

function checkCtn() {

	var theform = "Required Fields";
	var origform = theform;
	
	cfname = document.ctnform.realname.value;
	tcfemail = document.ctnform.email.value; cfemail = tcfemail.match("@");
	cfmssg = document.ctnform.message.value;

	
	if(cfname == "" || cfname == " " || cfname == "  " || cfname == "   ")
	{
		document.getElementById("cnfullname").className = "cninputR";
		theform += "addme";
	}
	else
	{
		document.getElementById("cnfullname").className = "cninput";
	}

	if(cfemail == "" || cfemail == null || cfemail == " " || cfemail == "  " || cfemail == "   ")
	{
		document.getElementById("cnemail").className = "cninputR";
		theform += "addme";
	}
	else
	{
		document.getElementById("cnemail").className = "cninput";
	}
	
	if(cfmssg == "" || cfmssg == " " || cfmssg == "  " || cfmssg == "   ")
	{
		document.getElementById("cnmssg").className = "cninputR";
		theform += "addme";
	}
	else
	{
		document.getElementById("cnmssg").className = "cninput";
	}
	
	
	
	if (theform == origform)
	{
		document.ctnform.submit();
		document.getElementById("errormsg").style.display = "none";
		return true;
	}
	else
	{
		document.getElementById("errormsg").style.display = "inline";
		window.scrollTo(0,0);
		return false;
	}

}

function imgloaded(limg,lhgt){

	var curimage = new Image();
	curimage.src = limg;
	
	curimgheight = curimage.height;
	curimgwidth = curimage.width;
	tempmargin = lhgt-curimgheight;
	thismarg = Math.round(tempmargin/2);
	
	addtxtmargin = curimgwidth-190;
	addtxtheight = (thismarg+curimgheight)+12;
	

	setTimeout("document.getElementById('psloading').style.display = 'none';",1000);
	
	document.getElementById("designworklrgimg").style.top = thismarg+"px";
	setTimeout("document.getElementById('designworklrgimg').style.display = 'block';",1000);
	
	document.getElementById("designworklrgtxt").style.top = addtxtheight+"px";
	document.getElementById("designworklrgtxt").style.marginLeft = addtxtmargin+"px";
	setTimeout("document.getElementById('designworklrgtxt').style.display = 'block';",1000);
		
}


function chgportfolio(timg,imtitle){

	if(!document.getElementById("designworklrg"))
	{
		var body = document.getElementsByTagName("body")[0];
		var dv   = document.createElement("div");
		var av   = document.createElement("a");
		body.appendChild(dv);
		dv.setAttribute("id", "designworklrg");
	}
	

	tdivid = "pthumb"+timg;
	divid = document.getElementById(tdivid);

	timgid = "ipthumb"+timg;
	imgid = document.getElementById(timgid);

	lblid = document.getElementById("designworklrg");


	if (self.pageYOffset) 
	{
		var scrolling = self.pageYOffset;
	} 
	else
	{
		var scrolling = document.documentElement.scrollTop;
	}
	
	tscreenheight = screen.availHeight;
	screenheight = tscreenheight-140;
	

	if(imtitle == "na")
	{
		corgimg = imgid.getAttribute("src");
		orgimg = corgimg.replace(/-tl.jpg/gi,"-t.jpg");
		imgid.src = orgimg;
		imgid.width = "230";
		imgid.height = "163";
		divid.className = "portfoliothumb";
		
		lblid.style.display = "none";
		lblid.innerHTML = '<div id="designworklrgimg"><div id="designworklrgtxt"></div></div><img src="/gfx/loading.gif" alt="Photograph Loading" id="psloading" />';
	}
	else
	{
		corgimg = imgid.getAttribute("src");
		orgimg = corgimg.replace(/-t.jpg/gi,"-tl.jpg");
		imgid.src = orgimg;
		imgid.width = "260";
		imgid.height = "184";
		divid.className = "portfoliothumblrg";
		
		orgimglrg = corgimg.replace(/-t.jpg/gi,".jpg");
		
		lblid.innerHTML = '<div id="designworklrgtxt">'+imtitle+'</div><img src="'+orgimglrg+'" alt="'+imtitle+'" id="designworklrgimg" onload="imgloaded(\''+orgimglrg+'\',\''+screenheight+'\')" /><img src="/gfx/loading.gif" alt="Photograph Loading" id="psloading" />';
		lblid.style.marginTop = scrolling+"px";
		lblid.style.display = "block";
		
		loadimgtemph = Math.round(tscreenheight/2);
		loadimgh = loadimgtemph-107;
		screenwidth = screen.availWidth;
		loadimgtempw = Math.round(screenwidth/2);
		loadimgw = loadimgtempw-28;

		document.getElementById("psloading").style.top = loadimgh+"px";
		document.getElementById("psloading").style.left = loadimgw+"px";
		document.getElementById("psloading").style.display = "block";
		
	
		if(navigator.userAgent.indexOf('Opera') != -1)
		{
			var imgtoload = new Image();
			imgtoload.src = orgimglrg;
			imgtoload.onload = function (){ imgloaded('orgimglrg','screenheight'); return false;}
		}
	
	}
}


function photoshoot(tid,imgt,imgs){

	if(imgt == "pt")
	{
		limgwidth = "260";
		limgheight = "184";
		imgwidth = "230";
		imgheight = "163";
		lrgclass = "portfoliothumblrg";
		smlclass = "portfoliothumb";
		
	}
	else if(imgt == "ls")
	{
		limgwidth = "140";
		limgheight = "184";
		imgwidth = "124";
		imgheight = "163";
		lrgclass = "portfoliothumblslrg";
		smlclass = "portfoliothumbls";
	}
	else if(imgt == "ld")
	{
		limgwidth = "260";
		limgheight = "74";
		imgwidth = "230";
		imgheight = "65";
		lrgclass = "portfoliothumbpslrg";
		smlclass = "portfoliothumbps";
	}

	tdivid = "p"+tid;	
	divid = document.getElementById(tdivid);
	timgid = "ip"+tid;
	imgid = document.getElementById(timgid);

	theimg = imgid.getAttribute("src");
	
	if(imgt == "ld")
	{
		theimglrg = theimg;
		theimgsml = theimg;
	}
	else
	{
		theimglrg = theimg.replace(/.jpg/gi,"-lrg.jpg");
		theimgsml = theimg.replace(/-lrg.jpg/gi,".jpg");
	}

	if(imgs == "1")
	{
		imgid.width = limgwidth;
		imgid.height = limgheight;
		imgid.src = theimglrg;
		divid.className = lrgclass;
	}
	else if(imgs == "0")
	{
		imgid.width = imgwidth;
		imgid.height = imgheight;
		imgid.src = theimgsml;
		divid.className = smlclass;
	}

}


function imgloadedps(limg,lhgt,lwgt,imgtyp){

	var curimage = new Image();
	curimage.src = limg;
	
	curimgheight = curimage.height;
	curimgwidth = curimage.width;
	
	leftsidetemp = lwgt-curimgwidth;
	leftside = Math.round(leftsidetemp/2);
	
	topsidetemp = lhgt-curimgheight;
	topside = Math.round(topsidetemp/2);
	
	if(imgtyp == "ps")
	{
		document.getElementById("lrgphotoinner").style.backgroundImage = "url('/gfx/portfolio-lrg-bg.png')";
	}
	else if(imgtyp == "ls")
	{
		document.getElementById("lrgphotoinner").style.backgroundImage = "url('/gfx/portfolio-lrg-ls-bg.png')";
	}
	else if(imgtyp == "lda")
	{
		document.getElementById("lrgphotoinner").style.backgroundImage = "url('/gfx/portfolio-lrg-psa-bg.png')";
	}
	else if(imgtyp == "ldb")
	{
		document.getElementById("lrgphotoinner").style.backgroundImage = "url('/gfx/portfolio-lrg-psb-bg.png')";
	}
	
	setTimeout("document.getElementById('psloading').style.display = 'none';",1000);
	setTimeout("document.getElementById('lrgphotoinner').style.display = 'block';",1000);

	document.getElementById("lrgphotoinner").style.width = curimgwidth+"px";
	document.getElementById("lrgphotoinner").style.height = curimgheight+"px";
	document.getElementById("lrgphotoinner").style.top = topside+"px";
	document.getElementById("lrgphotoinner").style.left = leftside+"px";
	document.getElementById("lrgphoto").style.display = "block";
		
}


function lrgphotoshoot(nimg,imgtyp){

	largephtmp = nimg.replace(/thumbs\//gi,"");
	largeph = largephtmp.replace(/-lrg.jpg/gi,".jpg");

	if(!document.getElementById("designworklrg"))
	{
		var body = document.getElementsByTagName("body")[0];
		var dv   = document.createElement("div");
		var av   = document.createElement("a");
		body.appendChild(dv);
		body.appendChild(av);
		dv.setAttribute("id", "lrgphoto");
		av.setAttribute("id", "fashionlink");
		av.setAttribute("name", "fashion");
	}

	if (self.pageYOffset) 
	{
		var scrolling = self.pageYOffset;
	} 
	else
	{
		var scrolling = document.documentElement.scrollTop;
	}
	
	document.getElementById("fashionlink").style.top = scrolling+"px";
	
	tscreenheight = screen.availHeight;
	screenheight = tscreenheight-140;
	
	screenwidth = screen.availWidth;

	document.getElementById("lrgphoto").style.top = scrolling+"px";
	document.getElementById("lrgphoto").innerHTML = '<div id="lrgphotoinner"><img src="'+largeph+'" onclick="closelrgphoto()" alt="Debbie Liu fashion design photography" onload="imgloadedps(\''+largeph+'\',\''+screenheight+'\',\''+screenwidth+'\',\''+imgtyp+'\')" /><img id="psclose" onclick="closelrgphoto()" src="/gfx/psclose.png" alt="close photograph" title="close photograph" width="48" height="46" /></div><img src="/gfx/loading.gif" alt="Photograph Loading" id="psloading" />';

	loadimgtemph = Math.round(tscreenheight/2);
	loadimgh = loadimgtemph-107;
	screenwidth = screen.availWidth;
	loadimgtempw = Math.round(screenwidth/2);
	loadimgw = loadimgtempw-28;

	document.getElementById("psloading").style.top = loadimgh+"px";
	document.getElementById("psloading").style.left = loadimgw+"px";
	document.getElementById("psloading").style.display = "block";
		
	if(navigator.userAgent.indexOf('Opera') != -1)
	{
		var imgtoload = new Image();
		imgtoload.src = largeph;
		imgtoload.onload = function (){ imgloadedps('largeph','screenheight','screenwidth','imgtyp'); return false;}
	}	
}


function closelrgphoto(){

	document.getElementById("lrgphoto").style.display = "none";
	document.getElementById("lrgphoto").innerHTML = '';

}

function createmenu(){

		var body = document.getElementsByTagName("body")[0];
		var dv   = document.createElement("div");
		var av   = document.createElement("a");
		body.appendChild(dv);
		body.appendChild(av);
		dv.setAttribute("id", "flmenu");
		av.setAttribute("href", "javascript:openmenu()");
		av.setAttribute("accesskey", "4");
	
	document.getElementById("flmenu").innerHTML = '<ul id="flmenulist"><li><a href="/" class="tmlink"><b>home</b></a></li><li><a href="/fashion_design_portfolio" class="tmlink"><b>design portfolio</b></a></li><li><a href="/freelance_fashion_design" class="tmlink"><b>freelance design</b></a></li><li><a href="/fashion_profile" class="tmlink"><b>profile</b></a></li><li><a href="/contact_me" class="tmlink"><b>contact</b></a></li><li><br /><br /><a href="javascript:closemenu()" class="tmlink"><b>close menu</b></a></li></ul>';

}

function openmenu(){
	document.getElementById("flmenu").style.display = "block";
}

function closemenu(){
	document.getElementById("flmenu").style.display = "none";
}


