"use strict";if(!this.JSON){this.JSON={};}
(function(){function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());


function concise(){concise.feedbackCounter=0;concise.feedbackCounterMax=0;concise.url='http://www.hansakonverentsid.ee';var o=document.getElementsByTagName("object");for(var i=0;i<o.length;i++){o[i].outerHTML=o[i].outerHTML;}}
concise.g=function(i){if(document.getElementById(i)){return document.getElementById(i);}else{return false}}
concise.safeurl=function(i){i=i.replace('&','%26');i=encodeURIComponent(i);return i;}
concise.disable=function(i){if(concise.g(i).disabled){concise.g(i).disabled=true;}else{concise.g(i).setAttribute('disabled',true);}}
concise.enable=function(i){concise.g(i).disabled=false;}
concise.GetXmlHttpObject=function(){var xmlHttp=null;try{/*Firefox, Opera 8.0+, Safari*/xmlHttp=new XMLHttpRequest();}catch(e){/*Internet Explorer*/try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}return xmlHttp;}
concise.addChart=function(u,i,a){
	concise.g("chartId"+i).style.display='none';
	concise.g("loading"+i).style.display='block';
	var xmlHttp=concise.GetXmlHttpObject();
	if(xmlHttp==null){
		alert("Browser does not support HTTP Request");
	}else{
		var amount=concise.g("amount"+i).value;
		if(parseInt(amount)>0&&parseInt(i)>0){
			var url=u+"&basket_id="+parseInt(i)+"&amount="+parseInt(amount)+"&"+Math.random()+"/";
			xmlHttp.open("GET",url,true);
			xmlHttp.onreadystatechange=function(){
				if(xmlHttp.readyState!=4) return;
				if(xmlHttp.status!=200) return;
				var r=JSON.parse(xmlHttp.responseText);
		    concise.g("basketMsg").innerHTML=""+r['result'];
		    concise.g("chartId"+i).style.display='block';
		    concise.g("loading"+i).style.display='none';
		    /*if(r['status']!='1'){concise.addChart(u,i,a);}*/
			}
			xmlHttp.send(null);
			
		}else{
			alert(a);
			concise.g("chartId"+i).style.display='block';
			concise.g("loading"+i).style.display='none';
		}
	}
}
concise.increase=function(i,s,t){
	var xmlHttp=concise.GetXmlHttpObject();
	if(xmlHttp==null){
		alert("Browser does not support HTTP Request");
	}else{
		var url=concise.url+'/&before_init='+((t==0)?'increase':'decrease')+'&basket_id='+parseInt(i)+'&size='+s+'/';
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState!=4) return;
			if(xmlHttp.status!=200) return;
			var r=JSON.parse(xmlHttp.responseText);
			if(r.p==0){
				if(!window.location.reload()){
					window.location.href=window.location.href;
				}
			}else{
				if(parseInt(r.a)>=0){
					concise.g("amount"+i).innerHTML=parseInt(r.a);
					concise.g("priceCount"+i).innerHTML=parseInt(r.c);
				}else{
					concise.g("productContainer"+i).innerHTML='';
					concise.g("productContainer"+i).style.display='none';
				}
			}
		}
		xmlHttp.send(null);
	}
}
concise.deleteProduct=function(i,s,t){
	var xmlHttp=concise.GetXmlHttpObject();
	if(xmlHttp==null){
		alert("Browser does not support HTTP Request");
	}else{
		var url=concise.url+'/&before_init=deleteProduct&basket_id='+parseInt(i)+'&size='+s+'/';
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState!=4) return;
			if(xmlHttp.status!=200) return;
			var r=JSON.parse(xmlHttp.responseText);
			if(r.p==0){
				if(!window.location.reload()){
					window.location.href=window.location.href;
				}
			}else{
				if(parseInt(r.a)>=0){
					concise.g("amount"+i).innerHTML=parseInt(r.a);
					concise.g("priceCount"+i).innerHTML=parseInt(r.c);
				}else{
					concise.g("productContainer"+i).innerHTML='';
					concise.g("productContainer"+i).style.display='none';
				}
			}
		}
		xmlHttp.send(null);
	}
}


concise.showDiv=function(v,s){
	if(concise.g(s)){
		if(concise.g(v).checked==true){
			concise.g(s).style.display='block';
		}else{
			concise.g(s).style.display='none';
		}
	}
}


concise.passwordChange=function(menu_name,p,pn,pc){
	concise.g("statusBigLoading").style.display='block';
	concise.g("statusBigText").style.display='none';
	concise.disable("buttonSubmit");
	var xmlHttp=concise.GetXmlHttpObject();
	if(xmlHttp==null){
		alert("Browser does not support HTTP Request");
	}else{
		var password=concise.safeurl(concise.g(p).value);
		var password_new=concise.safeurl(concise.g(pn).value);
		var password_new_confirm=concise.safeurl(concise.g(pc).value);
		var url=concise.url+"/"+menu_name+"&before_init=try-change-password&password="+password+"&password_new="+password_new+"&password_new_confirm="+password_new_confirm+"&"+Math.random()+"/";
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=function(){
			if(xmlHttp.readyState!=4) return;
			if(xmlHttp.status!=200) return;
			concise.g("statusBigLoading").style.display='none';
     	//var r=eval('(' + xmlHttp.responseText + ')');
     	var r=JSON.parse(xmlHttp.responseText);
	    concise.g("statusBigText").innerHTML='';
  	  for(var i in r['result']){
      	concise.g("statusBigText").innerHTML=concise.g("statusBigText").innerHTML+"<p>"+r['result'][i]+"</p>";
     	}
			concise.g("statusBigText").style.display='block';
			concise.enable("buttonSubmit");
			if(r.status==1){
				concise.g("password").value="";
				concise.g("password_new").value="";
				concise.g("password_new_confirm").value="";
			}
			concise.enable("buttonSubmit");
		}
		xmlHttp.send(null);
	}
}
concise.tryBlur=function(v,i,c){
	if(concise.g(i).value==''){
		concise.g(i).value=v;
		concise.g(i).className=c;
	}
}
concise.tryClick=function(v,i,c){
	if(concise.g(i).value==v){
		concise.g(i).value='';
		concise.g(i).className='';
	}
}

concise.checkFields=function(v,f1,f2,f3,f4){
	if(concise.feedbackCounter==concise.feedbackCounterMax){
		if(
		(concise.g('name'+v+concise.feedbackCounter).value!='')&&
		(concise.g('name'+v+concise.feedbackCounter).value!=f1)&&
		(concise.g('amet'+v+concise.feedbackCounter).value!='')&&
		(concise.g('amet'+v+concise.feedbackCounter).value!=f2)&&
		(concise.g('phone'+v+concise.feedbackCounter).value!='')&&
		(concise.g('phone'+v+concise.feedbackCounter).value!=f3)&&
		(concise.g('email'+v+concise.feedbackCounter).value!='')&&
		(concise.g('email'+v+concise.feedbackCounter).value!=f4)
		){
			concise.feedbackCounter++;
			concise.feedbackCounterMax++;
			newDiv = document.createElement("div");
			newDiv.id='tira'+concise.feedbackCounter;
			newDiv.className='datacell percent';
  		newDiv.innerHTML = '<div class="datacell percent1_4"><input id="name'+v+''+concise.feedbackCounter+'" value="'+f1+'" onblur="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\');if (value == \'\') {value=\''+f1+'\'}" onfocus="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\');if (value == \''+f1+'\') {value = \'\'}" onkeyup="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\')" class="inputtiny" type="text" name="nimi_'+v+'[]" /></div><div class="datacell percent1_4"><input id="amet'+v+''+concise.feedbackCounter+'" value="'+f2+'" onblur="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\');if (value == \'\') {value=\''+f2+'\'}" onfocus="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\');if (value == \''+f2+'\') {value = \'\'}" onkeyup="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\')" class="inputtiny" type="text" name="amet_'+v+'[]" /></div><div class="datacell percent1_4"><input id="phone'+v+''+concise.feedbackCounter+'" value="'+f3+'" onblur="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\');if (value == \'\') {value=\''+f3+'\'}" onfocus="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\');if (value == \''+f3+'\') {value = \'\'}" onkeyup="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\')" class="inputtiny" type="text" name="phone_'+v+'[]" /></div><div class="datacell percent1_4"><input id="email'+v+''+concise.feedbackCounter+'" value="'+f4+'" onblur="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\');if (value == \'\') {value=\''+f4+'\'}" onfocus="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\');if (value == \''+f4+'\') {value = \'\'}" onkeyup="concise.checkFields(\''+v+'\',\''+f1+'\',\''+f2+'\',\''+f3+'\',\''+f4+'\')" class="inputtiny" type="text" name="email_'+v+'[]" /></div></div>';
  		concise.g('mainMultiContainer2'+v).appendChild(newDiv);
		}
	}
}



this.concise();


$(document).ready(function(){
	$('.btn').each(function(){
		var b = $(this);
		var tt = b.text() || b.val();
		/*
		if ($(':submit,:button',this)) {
			b = $('<a>').insertAfter(this). addClass(this.className).attr('id',this.id);
			$(this).remove();
		}
		*/
		b.text('').css({cursor:'pointer'}).prepend('<i></i>').append($('<span>').
		text(tt).append('<i></i><span></span>'));
	});
});











function printPage(){
	if (window.print)
  	window.print()
  else
		alert("Your browser probably does't support Javascript");
}
var windowNote;
function showPic(title, pic, colorBack, wid, hei, idee){
	var idee = idee|| "default";
	windowNote = window.open('','Note'+ idee,'top=5, left=5, toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=' + wid + ',height='+ hei);
	image = '<a href="javascript:window.close()"><img src="'+ pic +'" width="'+ wid +'" height="'+ hei +'" border="0" alt="X"></a>';
	text = "<html><head><META HTTP-EQUIV=\"imagetoolbar\" CONTENT=\"no\"><title>"+ title + "</title></head><body bgcolor=\"#" + colorBack +"\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">" + image + "</body></html>";
	windowNote.document.write(text);
	windowNote.focus();
	windowNote.document.close();
	return false;
}
var type = "IE";
BrowserSniffer();
function BrowserSniffer(){
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";	//Opera
	else if (document.all) type="IE";							//Internet Explorer e.g. IE4 upwards
	else if (document.layers) type="NN";							//Netscape Communicator 4
	else if (!document.all && document.getElementById) type="MO";				//Mozila e.g. Netscape 6 upwards
	else type = "IE";									//I assume it will not get here
}
function hide_div(div_name)
{
	if (type=="IE") eval("document.all."+div_name+".style.display='none'");
	if (type=="NN") eval("document."+div_name+".display='none'");
	if (type=="MO" || type=="OP") eval("document.getElementById(div_name).style.display='none'");
}
function showhide_div(div_name){
	if (type=="IE"){
		if(eval("document.all."+div_name+".style.display")!='none'){
			eval("document.all."+div_name+".style.display='none'");
		}else{
			eval("document.all."+div_name+".style.display='block'");
		}
	}
	if (type=="NN"){
		if(eval("document."+div_name+".display")!='none'){
			eval("document."+div_name+".display='none'");
		}else{
			eval("document."+div_name+".display='block'");
		}
	}
	if (type=="MO" || type=="OP"){
		if(eval("document.getElementById('"+div_name+"').style.display")!='none'){
			eval("document.getElementById('"+div_name+"').style.display='none'");
		}else{
			eval("document.getElementById('"+div_name+"').style.display='block'");
		}
	}
}
function submit_form(){
	document.forms["MyFeedBack"].submit();
}
function reset_form(){
	document.getElementById('vorm').reset();
}
function change_picture(id){
	document.getElementById('mainpic').src=id;
}


