function rSEff(object) {
  if (object.className == 'dataTableRow') object.className = 'dataTableRowOver';
}

function rEEff(object) {
  if (object.className == 'dataTableRowOver') object.className = 'dataTableRow';
}

 function trShow(num){
	link = document.getElementById("tr"+num);
	raw  = document.getElementById("raw"+num);
	raw.style.display="";
	raw.style.visibility="visible";
	link.href="javascript:trHide("+num+")";
}

function trHide(num){
	link = document.getElementById("tr"+num);
	raw  = document.getElementById("raw"+num);
	raw.style.display="none";
	raw.style.visibility="hidden";
	link.href="javascript:trShow("+num+")";
}

var ua = navigator.userAgent.toLowerCase();
var divw=0;
var divh=0;

if (document.getElementById || document.all)
	document.write('<div id="imgtrailer" style="position:absolute;visibility:hidden;"></div>')

function gettrailobject()
	{
	if (document.getElementById)
		return document.getElementById("imgtrailer")
	else if (document.all)
		return document.all.trailimagid
	}

function gettrailobj()
	{
	if (document.getElementById)
		return document.getElementById("imgtrailer").style
	else if (document.all)
		return document.all.trailimagid.style
	}

function truebody()
	{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

function trailOff()
	{
	document.onmousemove='';
	gettrailobj().visibility="hidden";
	}

function trailOn(thumbimg,imgtitle,username,imgid,imgsize,credit,level,thw,thh)
	{
	if(ua.indexOf('opera') == -1 && ua.indexOf('safari') == -1)
		{
		gettrailobj().left="-500px";
		divthw = parseInt(thw) + 2;
		gettrailobject().innerHTML = '<div style="background-color: #b2a99d; layer-background-color: #b2a99d; border: 1px none #808080; padding:2px; width:'+divthw+'px;"><div style="background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px solid #808080;background-image: url(images/load.gif);">'+'<img src="'+thumbimg+'" border="0" width="'+thw+'"><div style="padding:2px">'+imgtitle+'</div></div></div>';
		gettrailobj().visibility="visible";
		divw = parseInt(thw)+25;
		divh = parseInt(thh)+130;
		document.onmousemove=followmouse;
		}
	}

function followmouse(e)
	{
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)
if(typeof e != "undefined")
	{
	if(docwidth < 15+e.pageX+divw)
		xcoord = e.pageX-divw-5;
	else
		xcoord = 15+e.pageX;
	if(docheight < 15+e.pageY+divh)
		ycoord = 15+e.pageY-Math.max(0,(divh + e.pageY - docheight - truebody().scrollTop - 30));
	else
		ycoord = 15+e.pageY;
	}
else if (typeof window.event != "undefined")
	{
	if(docwidth < 15+truebody().scrollLeft+event.clientX+divw)
		xcoord = truebody().scrollLeft-5+event.clientX-divw;
	else
		xcoord = truebody().scrollLeft+15+event.clientX;

	if(docheight < 15+truebody().scrollTop+event.clientY+divh)
		ycoord = 15+truebody().scrollTop+event.clientY-Math.max(0,(divh + event.clientY - docheight - 30));
	else
		ycoord = truebody().scrollTop+15+event.clientY;
	}
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
	}
	
function popupWindowPage(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=400,height=280,screenX=150,screenY=150,top=150,left=150')
}

function popupWindowPage_x(url,xwidth,xheight) {

  window.open(url,"popupWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + xwidth + ",height=" + xheight + ",screenX=150,screenY=150,top=150,left=150")
}

function popupWindowPage_xf(url,xwidth,xheight) {

my_firm = document.getElementById("chek_firms");
my_plat_num = document.getElementById("plat_num");
my_data_d_plat = document.getElementById("data_d_plat");
my_data_m_plat = document.getElementById("data_m_plat");

url = url + "&firm=" + my_firm.value + "&plat_num=" + my_plat_num.value + "&data_d_plat=" + my_data_d_plat.value + "&data_m_plat=" + my_data_m_plat.value;

 window.open(url,"popupWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + xwidth + ",height=" + xheight + ",screenX=150,screenY=150,top=150,left=150")
}



function test_email(form) {
/*
Ctrl = form.fr;
if (Ctrl.value == '' || Ctrl.value.indexOf ('@', 0) == -1 || Ctrl.value.length < 7) {
       validatePrompt (Ctrl, 'Email введен не корректно!')
       return (false);
} else {
       return (true);
}
*/
return (true);
}

function run_mail(form, button) {
if (!test_email(form)) return;
document.mail.submit();
return;
}

function add_products() {
/*
kol_input = document.getElementsByTagName("input");


if (kol_input.length >= 41) {
thisa = document.getElementById("add_products_shop");
thisa.style.display="none";
thisa.style.visibility="hidden";
}

if (kol_input.length <= 44) {
*/
this_id = document.getElementById("this_add_products_shop");
this_id.innerHTML += "<table cellpadding=2 cellspacing=0 id=zakaz_form_s><tr><td align=left><input name=p_product[] type=TEXT size=40></td><td align=left><input size=10 type=TEXT name=p_quantity[]></td><td align=left><input size=10 type=TEXT name=p_price[]>&nbsp;руб.</td></tr></table>";
//}

}

function skidka_percent() {
var this_percent = document.getElementById("this_skidka");
my_itog = "";
if (parseInt(this_percent.value) > 0) {
kol_input = document.getElementsByTagName("input");
for (i=0; i<kol_input.length; i++){


if (kol_input[i].name == "p_product[]" && kol_input[i].value.length > 0 && kol_input[i+1].value.length > 0 && kol_input[i+2].value.length > 0)
{
//alert((kol_input[i+2].title));
if ((kol_input[i+2].title) == "") {
kol_input[i+2].title = parseInt(kol_input[i+2].value);
}
kol_input[i+2].value = parseInt(kol_input[i+2].title) - ((parseInt(kol_input[i+2].title))/100*parseInt(this_percent.value)) ;
kol_input[i+2].value = Math.ceil(kol_input[i+2].value);

}
}
products_itog();
}


if (parseInt(this_percent.value) == 0) {
for (i=0; i<kol_input.length; i++){


if (kol_input[i].name == "p_product[]" && kol_input[i].value.length > 0 && kol_input[i+1].value.length > 0 && kol_input[i+2].value.length > 0)
{
if ((kol_input[i+2].title) == "") {
kol_input[i+2].title = parseInt(kol_input[i+2].value);
}
kol_input[i+2].value = kol_input[i+2].title ;
}
}
products_itog();
}

}


function products_itog() {
my_itog = 0;
kol_input = document.getElementsByTagName("input");
for (i=0; i<kol_input.length; i++){

if (kol_input[i].name == "p_product[]" && kol_input[i].value.length > 0 && kol_input[i+1].value.length > 0 && kol_input[i+2].value.length > 0){
my_itog = parseInt(my_itog) + (parseInt(kol_input[i+1].value) * parseInt(kol_input[i+2].value));
}

}

document.getElementById("itog").innerHTML = "Итого : " + my_itog + "руб.";

}





