var offsetfrommouse=[15,25]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0; //duration in seconds image should remain visible. 0 for always.
var defaultimageheight = 40;	// maximum image size.
var defaultimagewidth = 40;	// maximum image size.
var timer;
var data;
var Atbilde;
var a;
var xmlhttp;
function gettrailobj(){
if (document.getElementById)
return document.getElementById("projekts_preview").style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("projekts_preview")
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail(){	
	gettrailobj().display= "none";
	document.onmousemove=""
	gettrailobj().left="-500px"
	clearTimeout(timer);
}

function showtrail(imagename,title,width,height){
	document.getElementById('platums_bildei').value=width;
	i = imagename
	t = title
	w = width
	h = height
	timer = setTimeout("show('"+i+"',t,w,h);",200);
}

function show(imagename,title,width,height){
 
  var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth - offsetfrommouse[0]
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if( (navigator.userAgent.indexOf("Konqueror")==-1  || navigator.userAgent.indexOf("Firefox")!=-1 || (navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1)) && (docwidth>650 && docheight>500)) {
		( width == 0 ) ? width = defaultimagewidth: '';
		( height == 0 ) ? height = defaultimageheight: '';

		width+=30
		height+=55
		defaultimageheight = height
		defaultimagewidth = width
	
		document.onmousemove=followmouse; 

		var newHeight = '';
		var newHTML = '';
		newHTML += '<div class="konteiners">';
		newHTML += '<img class="preview_bilde" src="' + imagename + '" >';
		newHTML += '</div>';
		gettrailobjnostyle().innerHTML = newHTML;
		gettrailobj().display="block";
	}
}



function followmouse(e){
	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	var plat_bildei = document.getElementById('platums_bildei').value;
	plat_bildei = parseFloat(plat_bildei);
	xcoord = xcoord-plat_bildei;
	if(navigator.appName == 'Microsoft Internet Explorer'){
		var ycoord = ycoord-230;
		var xcoord = xcoord-230;
	}
	var xcoord = xcoord-40;
	var ycoord = ycoord+10;
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
}


function pirkt_poga(){
	document.getElementById('forma').action = '/'+sys_lang+'/grozs';
	document.getElementById('forma').submit();
}
function migrejam_uz_grozu(){	
	document.getElementById('forma').action = '/grozs';
	document.getElementById('forma').submit();
}
function migrejam(loc){
	document.getElementById('address').value = '/'+sys_lang+'/bode/'+loc;
	document.getElementById('forma').submit();
}
function migrejam2(loc){
	document.getElementById('forma').action = '/'+sys_lang+'/bonusi/'+loc;
	document.getElementById('forma').submit();
}

function every_week_product_checkbox(prece){
	var v = document.getElementById('hid_everyweek_product_'+prece).value;
	if(v == 'N'){
		document.getElementById('hid_everyweek_product_'+prece).value = 'Y';
		document.getElementById('everyweek_product_checkbox_'+prece).style.backgroundImage='url(/img/chbox_checked.gif)';
		nododam_serverim_produkta_piegades_biezumu(prece, 'Y');
	} else {
		document.getElementById('hid_everyweek_product_'+prece).value = 'N';
		document.getElementById('everyweek_product_checkbox_'+prece).style.backgroundImage='url(/img/chbox.gif)';
		nododam_serverim_produkta_piegades_biezumu(prece, 'N');
	}
}
function iepirksos_citrreiz_bet_saglabaasu_groza_sarakstu(){
	document.getElementById('data_action').value='iepirksos_citu_reizi';
	document.getElementById('reg_forma').submit();
}

function not_today(){
	document.getElementById('data_action').value='iepirksos_citu_reizi';
	if(validate('name', 'Nav ierakstīts vārds'))
	if(validate('surname', 'Nav ierakstīts uzvārds'))
	if(validate('address', 'Nav ierakstīta piegādes adrese'))
	if(validate('phone', 'Nav ierakstīts tālrunis'))
	if(checkmail('mail', 'Nav ierakstīts e-pasts'))
	if(validate('maksaashu', 'Nav norādīts veids kādā vēlaties norēķināties par pirkumiem.'))
	if(document.getElementById('data_accept').value == 'Y'){
		show_dialog('visible', '', ikaptvoi);
	} else {
		show_dialog('visible', 'Jums jāapstiprina, ka piekrītat noteikumiem.', 1);
		return false;
	}
}
function delete_grozs(){
	document.getElementById('delete_all').value = 'Y';
	document.getElementById('reg_forma').submit();
}

function nododam_rekalkuleet(Dati){
	var Dati = 'Dati='+Dati;
	var G_POST_Adrese = '/rekalkuleejam_groza_summu/';
	var Metode = 'POST';
	Adrese = G_POST_Adrese;
	var xmlhttp = null;
	if (window.XMLHttpRequest)
	xmlhttp = new XMLHttpRequest;
	else if (window.ActiveXObject)
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

	xmlhttp.open(Metode, Adrese, false);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function(){if (xmlhttp.readyState == 4){if (xmlhttp.status == 200){Atbilde = null;Atbilde = xmlhttp.responseText;}}};
	xmlhttp.send(Dati);
	if(xmlhttp.responseText!=null) Atbilde = xmlhttp.responseText;
	if(Atbilde!=null)document.getElementById('gala_summa').innerHTML = Atbilde;
}

function nododam_serverim_produkta_piegades_biezumu(dati_1, dati_2){
	var Dati = 'Dati='+dati_1+'_'+dati_2;
	var G_POST_Adrese = '/nododam_serverim_produkta_piegades_biezumu/';
	var Metode = 'POST';
	Adrese = G_POST_Adrese;
	var xmlhttp = null;
	if (window.XMLHttpRequest)
	xmlhttp = new XMLHttpRequest;
	else if (window.ActiveXObject)
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.open(Metode, Adrese, false);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function(){if (xmlhttp.readyState == 4){if (xmlhttp.status == 200){Atbilde = null; Atbilde = xmlhttp.responseText;}}};
	xmlhttp.send(Dati);
}


function pasuutam(Dati){
	var info='';
	info = info+indocument.getElementById('name').value;	
	var Dati = 'Dati='+Dati;
	var G_POST_Adrese = '/admin/ajax/';
	var Metode = 'POST';
	Adrese = G_POST_Adrese;
	xmlhttp = null;
	if (window.XMLHttpRequest)
	xmlhttp = new XMLHttpRequest;
	else if (window.ActiveXObject)
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.open(Metode, Adrese, false);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function(){if (xmlhttp.readyState == 4){if (xmlhttp.status == 200){atbilde = null; atbilde = xmlhttp.responseText;}}};
	xmlhttp.send(Dati);
}

function recalculate_grozs(){
	var ret = '';
	for (var i = 0; i < document.getElementById('reg_forma').elements.length; i++){var e = document.getElementById('reg_forma').elements[i];if (e.type == 'text' && e.id.substr(0, 13)=='precu_skaits_'){var preces_id = e.id.substr(13, e.id.length-13);var precu_skaits = e.value;ret = ret+'|'+preces_id+'_'+precu_skaits;}}
	var code=document.getElementById('code');
	if(code!=null && code!=undefined && code.value!='') {ret+='&code='+code.value;}
	if(ret!='') nododam_rekalkuleet(ret);
}

function buyNow()
{

	if(validate('name', 'Nav ierakstīts vārds'))
	if(validate('surname', 'Nav ierakstīts uzvārds'))
	if(validate('address', 'Nav ierakstīta piegādes adrese'))
	if(validate('phone', 'Nav ierakstīts tālrunis'))
	if(checkmail('mail', 'Nav ierakstīts e-pasts'))
	if(validate('maksaashu', 'Lūdzu apstipriniet samaksu par produktiem, saņemot pasūtījumu.'))
	if(document.getElementById('data_accept').value == 'Y'){
		show_dialog('visible','',rifpf);
	}else{
		show_dialog('visible', 'Jums jāapstiprina, ka piekrītat noteikumiem.', 1);
		return false;
	}
}

function acceptrulzz()
{
	var v = document.getElementById('data_accept');
	var vv = document.getElementById('accept');
	if(v.value == 'N')
	{
		document.getElementById('data_accept').value = 'Y';
		document.getElementById('accept').className = 'accept_button_act';
	}
	else
	{
		document.getElementById('data_accept').value = 'N';
		document.getElementById('accept').className = 'accept_button';
	}
}

function clickmycheckbox(n)
{
	var v = document.getElementById('hid_'+n).value;
	if(v == 'N')
	{
		document.getElementById('hid_'+n).value = 'Y';
		document.getElementById(n+'_checkbox').style.background = "url('/img/chbox_checked.gif')"
	}
	else
	{
		document.getElementById('hid_'+n).value = 'N';
		document.getElementById(n+'_checkbox').style.background = "url('/img/chbox.gif')"
	}
}

function every_week_checkbox()
{
	var v = document.getElementById('hid_everyweek').value;
	if(v == 'N')
	{
		document.getElementById('hid_everyweek').value = 'Y';
		document.getElementById('everyweek_checkbox').className = "every_week_act"
	}
	else
	{
		document.getElementById('hid_everyweek').value = 'N';
		document.getElementById('everyweek_checkbox').className = "every_week"
	}
}


function maksaashuaaa(nr) {
	if(nr == 1){
		document.getElementById('maksaashu').value = '1';
		document.getElementById('maksaashu_1').className = "maksaashu_1_act"
	}
}

function pazinjojam_pasuutiijuma_rezultaatus(){
	var o=document.getElementById('pasuutiishanas_rezultaatu_pazinjoshanas_indekss').value;
	if(o=='1'){show_dialog('visible',lndef[24],8);}else if(o == '2'){show_dialog('visible',lndef[25],1);}
}

function saglabat(){
	var u = document.getElementById('user').value;
	var p1 = document.getElementById('password').value;
	var p2 = document.getElementById('password2').value;
	POST_AJAX(u);
	var ua = document.getElementById('ss').value;
	if(p1 == p2 && p1.length>0 && p2.length>0 && ua == 1) {
		document.getElementById('data_login').value = document.getElementById('user').value;
		document.getElementById('data_password').value = document.getElementById('password').value;
		document.getElementById('users_choise_about_regisration').value='2';
		document.getElementById('reg_forma').submit();
	} else if (p1!=p2 || p1.length==0 || p2.length==0 || ua!=1) {
		if(ua == 0) document.getElementById('user_error').innerHTML = 'Šāds lietotājvārds nav derīgs.';
		else document.getElementById('user_error').innerHTML = '';
		if(p1 == p2) document.getElementById('password_error').innerHTML = 'Paroles nesakrīt.';
		else document.getElementById('password_error').innerHTML = '';
	}
}
function suutiijuma_statuss(xmlhttp){if(xmlhttp.readyState == 4){if(xmlhttp.status == 200){Atbilde = null;Atbilde = xmlhttp.responseText;document.getElementById('ss').value = Atbilde;var re = document.getElementById('user').value;var er = document.getElementById('password').value;document.getElementById('data_login').value = re;document.getElementById('data_password').value = er;document.getElementById('reg_forma').submit();}}}
function POST_AJAX(Dati){var Dati = 'Dati='+Dati;var G_POST_Adrese = '/ajax/';var Metode = 'POST';Adrese = G_POST_Adrese;xmlhttp = null;if (window.XMLHttpRequest)xmlhttp = new XMLHttpRequest;else if (window.ActiveXObject)xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");xmlhttp.open(Metode, Adrese, false);xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');xmlhttp.send(Dati);xmlhttp.onreadystatechange = suutiijuma_statuss(xmlhttp);}
function startLogin(){
	ajaxpost('getProductCount|'); 
	a=parseFloat(a);
	if(a>0){
		show_dialog('visible','<div style="text-align: center;" class="smallstyle">'+lndef[1]+'</div>',1);
	}else{show_dialog('visible','','4');}
}
function registrationStart(){ajaxpost('getProductCount|');a = parseFloat(a);if(a>0){show_dialog('visible','<div style="text-align:center;" class="smallstyle">'+lndef[1]+'</div>',1);}else{show_dialog('visible','',7);}}
function check_for_ability_to_log_in(){
	var u = document.getElementById('mail').value.length;
	var p = document.getElementById('password').value.length;
	if(u>0 && p>0){document.getElementById('log_in').disabled = false;}else document.getElementById('log_in').disable = true;
}
function ne_paldies(){document.getElementById('users_choise_about_regisration').value='2';document.getElementById('reg_forma').submit();}
function show_dialog(visible, text, type){
	if(type == 1){
		var pazinojums = '<div style="color:#535828; font-size:14px; font-family:arial;" align="center">'+text+'<br/><br/><div style="width:98px;"><a style="display:block; width:98px;" href="#" onClick="show_dialog(\'hidden\')" class="labi"><font class="pogasnoformejums" style="padding-top:5px;">'+lndef[2]+'</font></a></div></div>';
	}else if (type == 2){
		document.getElementById('reg_forma').submit();
		return false;
	}else if (type == 3){
		document.getElementById('reg_forma').submit();
		return false;
	}else if (type == 4){
		var pazinojums = '<div style="width:500px; height:100px; color:#535828; font-size:13px; font-family:arial;" align="center">';
		pazinojums+='<br/><br/>'+lndef[3]+'<br><br>';
		pazinojums+='<form method="POST" id="login">';
		pazinojums+='<table cellpadding="0" cellspacing="0" STYLE="border:0px; color:#535828; font-size:13px; padding-bottom:5px; font-family:arial; padding-right:10px;">';
		pazinojums+='<tr>';
		pazinojums+='<td align="right">'+lndef[4]+'</td>';
		pazinojums+='<td align="left" style="padding-bottom:5px;">';
		pazinojums+='<input type="text" onKeyUp="check_for_ability_to_log_in();" name="reg[mail]" id="mail" class="reginput" style="width:110px;">';
		pazinojums+='</td></tr>';
		pazinojums+='<tr><td align="right">'+lndef[5]+'</td><td align="left">';
		pazinojums+='<input type="password" class="reginput" name="reg[password]" onKeyUp="check_for_ability_to_log_in();" id="password" style="width:110px;">';
		pazinojums+='</td></tr><tr><td align="center" colspan="2"><input type="checkbox" name="reg[rememberme]" value="Y" />'+lndef[6]+'</td></tr>';
		pazinojums+='<tr><td colspan="2" id="notification" style="padding: 5px; color: red; text-align: center;"></td></tr>';
		pazinojums+='</table>';
		pazinojums+='<div style="width:98px; padding-top:10px;">';
		pazinojums+='<a href="#" disabled style="display:block; width:98px; border:0px;" onClick="login();" id="log_in" class="enter">';
		pazinojums+='<font class="pogasnoformejums">'+lndef[7]+'</font></a></div></form></div>';
	}else if(type == 5){
		var pazinojums = '<div style="width:500px; height:80px; color:#535828; font-size:13px; font-family:arial;" align="center"><form method="POST" id="tiiram_grozu"><input type="hidden" name="empty_grozs" value="Y"><br/>'+lndef[8]+'<br></br><table cellpadding="0" cellspacing="0" border:0px;><tr><td style="padding-left:20px;"><a href="#" onClick="show_dialog(\'hidden\');" class="cancel"><font class="pogasnoformejums" onClick="iepirksos_citrreiz_bet_saglabaasu_groza_sarakstu();">'+lndef[2]+'</font></a></td></tr></table></form></div>';
	}else if(type == 6){
		var pazinojums = '<div style="width:500px; height:80px; color:#535828; font-size:13px; font-family:arial;" align="center">';
		pazinojums+='<br/>'+lndef[9]+'<br></br>';
		pazinojums+='<table cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-left:20px;">';
		pazinojums+='<a href="#" onClick="show_dialog(\'hidden\');" class="cancel">';
		pazinojums+='<font class="pogasnoformejums" onClick="delete_grozs();">'+lndef[10]+'</font></a>';
		pazinojums+='</td><td style="padding-left:20px;"><a href="#" onClick="show_dialog(\'hidden\');" class="cancel">';
		pazinojums+='<font class="pogasnoformejums" onClick="show_dialog(\'hidden\', \'\', \'\');">'+lndef[11]+'</font>';
		pazinojums+='</a></td></tr></table></div>';
	}else if(type == 7){
		var pazinojums = '<div style="width:250px; height:200px; color:#535828; font-size:13px; font-family:arial; text-align: center; display: table;" align="center">';
		pazinojums+='<br/>'+lndef[12]+'<br></br>';
		pazinojums+='<form method="post" id="dialogRegistraacijasForma">';
		pazinojums+='<table cellpadding="0" cellspacing="5" border="0" style="color:#535828; font-size:13px; font-family:arial;">';
		pazinojums+='<tr><td style="padding-left:40px;">'+lndef[13]+'</td><td style="padding-left:20px;">';
		pazinojums+='<input style="width: 170px;" type="text" name="new_user[name]" id="new_user_name" class="reginput" /></td></tr><tr>';
		pazinojums+='<td style="padding-left:40px;">'+lndef[14]+'</td><td style="padding-left:20px;">';
		pazinojums+='<input style="width: 170px;" type="text" name="new_user[surname]" id="new_user_surname" class="reginput" /></td>';
		pazinojums+='</tr><tr><td style="padding-left:40px;">'+lndef[15]+'</td><td style="padding-left:20px;">';
		pazinojums+='<input style="width: 170px;" type="text" name="new_user[address]" id="new_user_address" class="reginput" /></td></tr>';
		pazinojums+='<tr><td style="padding-left:40px;">'+lndef[16]+'</td><td style="padding-left:20px;">';
		pazinojums+='<input style="width: 170px;" type="text" name="new_user[phone]" id="new_user_phone" class="reginput">';
		pazinojums+='</td></tr><tr><td style="padding-left:40px;">'+lndef[17]+'</td><td style="padding-left:20px;">';
		pazinojums+='<input style="width: 170px;" type="text" name="new_user[mail]" id="new_user_mail" class="reginput">';
		pazinojums+='</td></tr><tr><td style="padding-left:40px;">'+lndef[18]+'</td><td style="padding-left:20px;">';
		pazinojums+='<input style="width: 170px;" type="password" name="new_user[password]" id="new_user_password" class="reginput">';
		pazinojums+='</td></tr><tr><td style="padding-left:40px;">'+lndef[19]+'</td><td valign="top" style="padding-left:20px;">';
		pazinojums+='<input style="width: 170px;" type="password" name="new_user[password2]" id="new_user_confirm_password" class="reginput">';
		pazinojums+='</td></tr><tr><td style="padding-left:40px;"><br/>'+lndef[20]+'</td><td style="padding-left:20px;" valign="top"><br/>';
		pazinojums+='<input style="width: 170px;" type="text" name="new_user[kur_uzzinaaji]" class="reginput">';
		pazinojums+='</td></tr><tr><td colspan="2"><br /><br />'+lndef[21]+'</td></tr><tr>';
		pazinojums+='<td colspan="2" align="center" style="color: red; padding: 3px;" id="notification">&nbsp;</td></tr>';
		pazinojums+='<tr><td colspan="2" align="center"><br/><table cellpadding="0" cellspacing="0" style="border: 0px;"><tr>';
		pazinojums+='<td style="padding-left:20px; text-align: center;">\<a href="#" class="cancel" onClick="validateRegistrationForm();"><font class="pogasnoformejums">'+lndef[22]+'</font></a></td>';
		pazinojums+='<td style="padding-left:20px; text-align: center;"><a href="#" onClick="show_dialog(\'hidden\');" class="cancel"><font class="pogasnoformejums" onClick="show_dialog(\'hidden\', \'\', \'\');">'+lndef[23]+'</font></a>';
		pazinojums+='</td></tr></table></td></tr></table></form></div>';
		pazinojums+='';
	}else if(type==8){
		var pazinojums = '<div style="color:#535828; font-size:14px; font-family:arial;" align="center">'+text+'<br/><br/><div style="width:98px;"><a style="display:block; width:98px;" href="#" onClick="window.location=\'/'+sys_lang+'/home\'" class="labi"><font class="pogasnoformejums" style="padding-top:5px;">'+lndef[2]+'</font></a></div></div>';
	}
	if(visible == 'visible' && pazinojums!=null && pazinojums!=''){
		document.getElementById('dialog_background').style.visibility = 'visible';
		document.getElementById('dialog_box').style.visibility = 'visible';
		document.getElementById('dialog_background').style.zIndex = '999';
		document.getElementById('dialog_box').style.zIndex = '1000';
		document.getElementById('texts').innerHTML = pazinojums;
		var closeBut = '\<a  href="#" onClick="show_dialog(\'hidden\');" style="position:relative; top:10px; left:-28px; width:16px; height:16px; float:right; background:url(\'{pic_url}/close_but.gif\') no-repeat top right;">&nbsp;</a>';
		document.getElementById('ssf').innerHTML=closeBut;
	}else{
		document.getElementById('dialog_background').style.visibility = 'hidden';
		document.getElementById('dialog_box').style.visibility = 'hidden';
		document.getElementById('dialog_background').style.zIndex = '0';
		document.getElementById('dialog_box').style.zIndex = '0';
	}
}
function ajaxpost(Dati){
	var G_POST_Adrese = '/ajax/';
	var Metode = 'POST';
	var Dati = 'Dati='+Dati;
	Adrese = G_POST_Adrese;
	xmlhttp = null;
	if (window.XMLHttpRequest)
	xmlhttp = new XMLHttpRequest;
	else if (window.ActiveXObject)
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.open(Metode, Adrese, false);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.onreadystatechange = function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){a=null;a=xmlhttp.responseText;}}}
	xmlhttp.send(Dati);
	a = xmlhttp.responseText;
}
function validateRegistrationForm(){var notification = '';var nu_name = document.getElementById('new_user_name').value;var nu_surname = document.getElementById('new_user_surname').value;var nu_address = document.getElementById('new_user_address').value;var nu_phone = document.getElementById('new_user_phone').value;var nu_mail = document.getElementById('new_user_mail').value;var nu_password1 = document.getElementById('new_user_password').value;var nu_password2 = document.getElementById('new_user_confirm_password').value;if(nu_name.length>0){if(nu_surname.length>0){if(nu_address.length>0){if(nu_phone.length>0){if(nu_mail.length>0){var filter=/^.+@.+\..{2,3}$/;if (filter.test(nu_mail)){ajaxpost('checkMail|'+nu_mail);a = a.split('*');if(a[1]!=null && a[1]=='1'){if(nu_password1.length>0){if(nu_password2.length>0){if(nu_password1==nu_password2){document.getElementById('dialogRegistraacijasForma').submit();}else{notification=lndef[26];}}else {notification=lndef[27];}}else {notification=lndef[28];}}else{notification=lndef[29];}}else{notification=lndef[30];}}else{notification=lndef[31];}}else{notification=lndef[32];}}else{notification=lndef[33];}}else{notification=lndef[34];}}else{notification=lndef[35];}document.getElementById('notification').innerHTML = notification;return false;}
function login(){var notification=null;var mail = document.getElementById('mail').value;var pass = document.getElementById('password').value;if(mail.length==0){notification=lndef[36];}if(pass.length==0){notification=lndef[37];}ajaxpost('loginValodation|&mail='+mail+'&password='+pass);a = a.split('*');if(a[1]!=null && a[1]=='1'){notification=lndef[38];}if(notification!=null && notification!=''){document.getElementById('notification').innerHTML = notification;return false;}else{document.getElementById('login').submit();return false;}}
function createCookie(days) {if (days) {var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = "dabasdobe_remember_me_on_this_computer"+"=''"+expires+"; path=/";}
function logofff(){createCookie(name,"",-1);document.getElementById('logout').submit();return false;}
function searchfield(){if(document.getElementById('search').value.length > 0){document.getElementById('search_form').submit();}else{show_dialog('visible',lndef[39],1);return false;}}
function ieteikt(){if(validate('name',lndef[40]))if(validate('phone',lndef[41]))if(checkmail('mail',lndef[42]))if(validate('text',lndef[43])){document.getElementById('forma').submit();show_dialog('visible',lndef[44],1);}else{show_dialog('visible',lndef[45],1);return false;}}

function pool(id){
	var radio=document.getElementById('atbildes').getElementsByTagName('div');
	document.getElementById('answ').value=id;
	for(var i=0; radio.length>i; i++){
		if(radio[i].className!='radio_inact' && radio[i].className!='radio_act') continue;
		radio[i].className=(radio[i].id=='answ_'+id)?'radio_act':'radio_inact';
	}
}









