function view(d,f,q,p,w,h){
//alert(d+'/'+f+'/'+q);
var kl=parent.document.getElementById("view_img");
kl.innerHTML='';
//alert(h+','+w)
if(h>475 && h>w){
var k=h/w;
h=475;
w=h/k;
}
kl.innerHTML='<img src="templates/'+p+'/data/generated/'+d+'/'+f+'/'+q+'__scaled_400.jpg" onclick=viewBig('+d+','+f+',\''+q+'\',\''+p+'\') style="cursor:pointer;height:'+h+'px;width:'+w+'px" style="border: double 3 #00ccff">'; 
}
function viewBig(d,f,q,p){
newWindow = window.open('img_big.php?q='+q+'&d='+d+'&f='+f+'&p='+p,'big','left=0,resizable=no,scrollbars=no,top=0,status=no');
}
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	Insert smiley code
	+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
function insertCode(code) {
	var cache = document.tb_form.questbook_text.value;
	this.code = code;
	document.tb_form.questbook_text.value = cache + code;
	document.tb_form.questbook_text.focus();
}

function submitGuest(){
 var GName=document.tb_form.questbook_name.value;
 var GMail=document.tb_form.questbook_mail.value;
 var GMES=document.tb_form.questbook_text.value;
 var GCAP=document.tb_form.captcha.value;
 var noemail=document.tb_form.questbook_mail.value.indexOf('@') == -1
 var err=false;
 if(GMail){
  if(noemail){
	 alert("Neteisingas el.pašto adresas");
	 err=true;
	}
 }
 if(!GName){
	 alert ("Prašome užpildyti \"Name\" laukus")
	 err=true;
 }
 if(!GMES){
	 alert ("Prašome užpildyti \"Message\" laukus")
	 err=true;
 }
 if(!GCAP){
	 alert ("Prašome užpildyti \"Captcha\" laukus")
	 err=true;
 }
 if(err){
  event.returnValue= false
 }else{
  event.returnValue= true
 }
}
