$(function(){
	//
	//ResizeDivFone();
	//
	$(document).pngFix();
});

// ИСПОЛЬЗОВАТЬ ВМЕСТО getElementById() ФУНКЦИЮ js() (может отдать массив элементов, если передать несколько id)
function js() 
{
	var elements, i;

	if(arguments.length == 1)
		return document.getElementById(arguments[0]);

	elements = new Array();
	for(i=0; i<arguments.length; i++) 
		elements.push(document.getElementById(arguments[i]));

	return elements;
}

function ResizeDivFone()
{
	js('cent_fon1').style.height = js('cent1').clientHeight.toString() + "px";
	js('cent_fon2').style.height = js('cent2').clientHeight.toString() + "px";
}

function ShowHide(element)
{
	if(element.style.display=='none')
		element.style.display='block';
	else
		element.style.display='none';
}

function zayavka(id)
{
	window.open('/show_zayavka.php?id='+id,'','width=450,height=500,resizable=yes,scrollbars=yes,menubar=no,status=no');
}

function detail(hd,d)
{
	for(i=1; i<4; i++)
	{
		_div = document.getElementById("detail"+i);
		_div.style.display = d==i ? "block" : "none";
	}

	_div = document.getElementById("detailHide");
	_div.style.display = hd;
}
function check_rep_frm(Obj)
{
	var flag = 0;
	
	var d1 = Obj.max_date.value;
	var d2 = Obj.data1.value;
	var d3 = Obj.data2.value;
	var d_max = Date.parse(d1.substring(6,10)+'/'+d1.substring(3,5)+'/'+d1.substring(0,2));
	var d_start = Date.parse(d2.substring(6,10)+'/'+d2.substring(3,5)+'/'+d2.substring(0,2));
	var d_end = Date.parse(d3.substring(6,10)+'/'+d3.substring(3,5)+'/'+d3.substring(0,2));

	if((d_start>d_end)||(d_end>d_max))	
	{
		alert('Введите корректный период!');
		flag++;
	}
	
	if((Obj.ya.checked==false)&&(Obj.rm.checked==false)&&(Obj.gg.checked==false))
	{
		alert('Выберите поисковик!');
		flag++;
	}
	
	if(flag==0)
		Obj.submit();
}

function makeStripe(tab)
{
    var rows = tab.getElementsByTagName("tr");

    if (!rows)
        return;

    for(var i=0; i<rows.length; i++)
        rows[i].className = ((i%2)==0 ? "odd" : "even");
}

function check_poisk(Obj,hide_obj)
{
	if(Obj.checked==true)
		hide_obj.value = 1;
	else
		hide_obj.value = 0;
}

function show_popup_window(url,Koef_width)
{
	var W = document.body.clientWidth;
	W = Math.round(W*Koef_width);
	var H = Math.round(W*0.75);
	showPopWin(url, W, H, null);
}

function show_popup_window1(url)
{
	var H = Math.round(window.screen.height*0.6);
	showPopWin(url, 900, H, null);
}

























