function show(name, width, height) {
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	opt = 'toolbar=no, menubar=no, width='+width+', height='+height+', scrollbars=no, location=no, titlebar=yes, directories=no, screenX='+top+', screenY='+left+', top='+top+', left='+left;
	loc = '/site/display.php?img='+name;
	window.open(loc, "", opt);
}
function Roll(obj, new_style) {
	obj.className = new_style;
}
// Show Hide Change style.
function shc(whichlayer, obj, new_style, old_style) {
	var style5=document.getElementById(whichlayer).style;
	if(style5.display=='block') {
		style5.display='none';
	    obj.className = new_style;
	}else {
		style5.display='block';
	    obj.className = old_style;
	}
}
function sh(whichlayer) {
	var style2=document.getElementById(whichlayer).style;
	if(style2.display=='block')
		style2.display='none';
	else
		style2.display='block';
}

function shI(whichlayer) {
	var style2=document.getElementById(whichlayer).style;
	if(style2.display=='inline')
		style2.display='none';
	else
		style2.display='inline';
}


function s(whichlayer) {
	var style2=document.getElementById(whichlayer).style;
	style2.display='block';
}
function sI(whichlayer) {
	var style2=document.getElementById(whichlayer).style;
	style2.display='inline';
}

function h(whichlayer) {
	var style2=document.getElementById(whichlayer).style;
	style2.display='none';
}


//INPUT Fields
function highlight(element, state) {
	obje = document.getElementById(element);
	
	if(state==1){ 
		obje.className="inp_f"; // Focus
	}else if(state==2){ 
		if(obje.className=="inp") {
			obje.className="inp_h"; // MouseOver
		}
	}else if(state==3){ 
		if(obje.className!="inp_f") {
			obje.className="inp"; // MouseOut
		}
	}else {
		obje.className="inp"; // Blur
	}
}

function showcase(id, imgid, pos) {
	var w = 580;
	var h = 580;
	var left = (screen.width - w) / 2;
	var top = (screen.height - h) / 2;
	winprops = 'toolbar=no, menubar=no, width='+w+', height='+h+', scrollbars=no, location=no, titlebar=yes, directories=no, screenX='+top+', screenY='+left+', top='+top+', left='+left;
	
	url = '/site/showcase.php?id='+id+'&imgid='+imgid+'&pos='+pos;
	window.open(url, '', winprops);
}

function Close () {
	window.close();
}


function showForms() {
	
//	var sel = document.requestform.inquiry;
		
	forms = new Array();
	first_inp = new Array();
	forms[0] = 'web';
	forms[1] = 'logo_f';
	forms[2] = 'print';
	forms[3] = 'others';
	
	first_inp[0] = 'w_your_website';
	first_inp[1] = 'l_logo_for';
	first_inp[2] = 'pr_design_for';
	first_inp[3] = 'o_type_of_services';
	
//	if(document.requestform.inquiry.value=='web') {
//		var object = document.getElementById('web').style;
//		object.display = 'block';
//	}
	
	
	for (i=0; i<4; i++) {
		var object = document.getElementById(forms[i]).style;
		
			if(forms[i]==document.requestform.inquiry.value) {
				object.display = 'block';
			
				f_inp = eval ('document.requestform.'+first_inp[i]);
			
				f_inp.focus();
				continue;
			}

		object.display = 'none';
	}
	
	
}

function focusC() {
	document.contactform.name.focus();
}
function focusR() {
	document.requestform.p_f_name.focus();
}

function mailto(mailstr) {
	var pattern = /#/g;
	var newString = mailstr.replace(pattern,"@");
	top.location = "mailto:"+newString;
}

function Reset(formname) {
	form = eval('document.'+formname);
	form.reset();
	form.name.focus();
}

function keywordFocus(formname, word) {
	keyword = eval('document.'+formname+'.keyword');
	if(keyword.value==word) {
		keyword.value = '';
	}
}
function keywordBlur(formname, word) {
	keyword = eval('document.'+formname+'.keyword');
	if(keyword.value=="") {
		keyword.value=word;
	}
}
function sendToFriend(type, id, lang) {
	loc = '/site/send_to_friend.php?type='+type+'&id='+id+'&lang='+lang;
	var ww = 550;
	var wh = 420;
	
	var w = (screen.width - ww);
	var h = (screen.height - wh);

	
	window.open(loc, '', 'toolbar=no, menubar=no, width='+ww+', height='+wh+', scrollbars=no, location=no, titlebar=yes, directories=no, top='+(parseInt(h)/2)+', left='+(parseInt(w)/2));
}

var pr = false;
function PrintView(topen, tclose) {
	h = document.documentElement.firstChild;

	var linkPrintView = document.createElement( "link" );
	linkPrintView.id = "printview";
	linkPrintView.rel = "stylesheet";
	linkPrintView.type = "text/css";
	linkPrintView.media = "all";
	linkPrintView.href = "/styles/printview.css";

	
	if(!document.getElementById("printview")) {
		h.appendChild( linkPrintView );
	}
		
	var	linkId = document.getElementById("printview")
	var printId = document.getElementById("printlink");

	if(pr) {
		linkId.href="";
		printId.innerHTML = topen;
		pr = false;
	}else {
		pr = true;
		linkId.href="/styles/printview.css";
		printId.innerHTML = tclose;
	}
	
}
