// определение браузера
var ie=false;
if(!/Gecko/.test(navigator.userAgent)&&!/Opera/.test(navigator.userAgent))
	ie=true;
// при изменении размеров
function bodySize(){
	if(document.documentElement.clientWidth)
		document.body.style.width=(document.documentElement.clientWidth<1000)?"1000px":"100%";
}
onload=function(){
	//preloadIcons();
	if(ie){
		bodySize();
		onresize=bodySize;
	}
}

function searchClick(){
	if(document.getElementById('search').style.display!='block'){
		document.getElementById('search').style.display='block';
		document.getElementById('search_link').style.cssText='border: none !important;';
		document.getElementById('search_link').style.border='none';
	}else{
		document.getElementById('search').style.display='none';
		document.getElementById('search_link').style.cssText='border-bottom: 1px dashed #000000 !important;';
	}
}
function itemHideShow(prefix,id,url){
	var frame=document.getElementById(prefix+'_frame_'+id);
	if(document.getElementById(prefix+'_full_'+id).style.display!='block'){
		document.getElementById(prefix+'_full_'+id).style.display='block';
		document.getElementById(prefix+'_link_'+id).style.cssText='border: none !important;color: #000000;background: #858585;padding: 0 5px 0 5px;';
		if(!frame.contentWindow.loaded){
			document.getElementById(prefix+'_'+id).style.cssText='background: url(sait/images/loading.gif) no-repeat right top;';
			frame.src=url;
		}else{
			document.getElementById(prefix+'_'+id).style.cssText='background: url(sait/images/spacer.gif) no-repeat right top;';
		}
	}else{
		document.getElementById(prefix+'_full_'+id).style.display='none';
		document.getElementById(prefix+'_link_'+id).style.cssText='border-bottom: 1px dashed #1a5fd1 !important;color: #1a5fd1;';
		document.getElementById(prefix+'_'+id).style.cssText='';
	}
}
function otherReview(cId,count){
	var i=parseInt(document.getElementById('reviewNum_'+cId).value);
	document.getElementById('review_'+cId+'_'+i).style.display='none';
	i=(i+1)%count;
	document.getElementById('review_'+cId+'_'+i).style.display='block';
	document.getElementById('review_'+cId+'_'+i).scrollIntoView();
	window.scrollBy(0,-20);
	document.getElementById('reviewNum_'+cId).value=i;
}
function otherMakets(pId){
	if(document.getElementById('maket_'+pId).style.display!='block'){
		document.getElementById('maket_'+pId).style.display='block';
		document.getElementById('maket_link_'+pId).style.cssText='color: #000000;background: #858585;padding: 0 5px 0 5px;border: none;';
	}else{
		document.getElementById('maket_'+pId).style.display='none';
		document.getElementById('maket_link_'+pId).style.cssText='border-bottom: 1px dashed #1a5fd1;';
	}
}
function subMap(pId){
	if(document.getElementById('submap_'+pId).style.display!='block')
		document.getElementById('submap_'+pId).style.display='block';
	else
		document.getElementById('submap_'+pId).style.display='none';
}
function orderHideShow(id){
	if(document.getElementById('order_'+id).style.display!='block'){
		document.getElementById('order_'+id).style.display='block';
		document.getElementById('order_link_'+id).style.cssText='border: none !important;color: #000000;background: #858585;padding: 0 5px 0 5px;';
	}else{
		document.getElementById('order_'+id).style.display='none';
		document.getElementById('order_link_'+id).style.cssText='border-bottom: 1px dashed #1a5fd1 !important;color: #1a5fd1;';
	}
}
function loadImage(url){
	var i=new Image;
	i.src=url;
}
/*function preloadIcons(){
	var icons=new Array('image/downloads/st_mn_main_bomb.jpg',
		'image/downloads/st_mn_main_bomb_act.jpg',
		'image/downloads/st_mn_main_brain.jpg',
		'image/downloads/st_mn_main_brain_act.jpg',
		'image/downloads/st_mn_main_cup.jpg',
		'image/downloads/st_mn_main_cup_act.jpg',
		'image/downloads/st_mn_main_hand.jpg',
		'image/downloads/st_mn_main_hand_act.jpg',
		'image/downloads/st_mn_main_heart.jpg',
		'image/downloads/st_mn_main_heart_act.jpg',
		'image/downloads/st_mn_main_mouthpiece.jpg'
	);
	var im=new Array();
	var j=0;
	for(var i in icons){
		im[j]=new Image;
		im[j].src=icons[i];
		j++;
	}
}*/
function ajaxMessage(code,num){
	for(var i=0; i<document.getElementById(code+'_hide').childNodes.length; i++)
		if(document.getElementById(code+'_hide').childNodes[i].nodeName=='DIV')
			document.getElementById(code+'_hide').childNodes[i].style.display='none';
	if(num){
		document.getElementById(code+'_message_'+num).style.display='block';
		document.getElementById(code+'_hide').style.display='block';
		if(num==1)
			document.forms[code+'_form'].reset();
	}
}