$(function() {
$('.gallery').lightBox({
	imageLoading: '/images/lightbox-ico-loading.gif',
	imageBtnClose: '/images/lightbox-btn-close.gif',
	imageBtnPrev: '/images/lightbox-btn-prev.gif',
	imageBtnNext: '/images/lightbox-btn-next.gif'
	});
});

$(function() {
  $('.flashobj').each(function() {
    var params = $(this).attr("rel").split(":");
	$reg = (!params[0]?params[0]:$(this).attr("rel"));
	$wi = $(this).width();
	$he = $(this).height();
	flashMovieWithVars = $.flash.create(
	{
		swf: ''+$reg+'',
		width: $wi,
		height: $he,
		allowFullScreen: true,
		wmode: 'transparent'
//,
//		flashvars: {
//			battleMode: true,
//			computer: true,
//			players: 2
//		}
	});
	if ($.flash.available) $(this).html(flashMovieWithVars);
	});
});



function hi_window(page)
        {
        var url=page;
        var settt=window.open( url, "his" ,"toolbar=no,directories=no,scrollbars=yes,status=yes,resizable=yes,width=500,height=400");
        }


function hiza()
        {
        window.open( "/new.htm", "ahis" ,"toolbar=no,directories=no,scrollbars=no,status=no,resizable=no,width=400,height=200");
        }



function nxtl(elm,nexta,cods)
{
	if (navigator.appName=="Microsoft Internet Explorer" || navigator.appName=='Opera')
		{
		if (elm.value.length>=elm.maxLength && cods!=8 && cods!=46 && cods!=9 && cods!=16)
			{
			var oForm=elm.form;
			oForm[nexta].focus();
			return false;
			}
		}
}

function disp(id_obj)
{
var dsp =document.getElementById(id_obj).style;
var himg =document.getElementById('himg'+id_obj);
dsp.display = (dsp.display != 'block' ? 'block' : 'none');
if (himg!=null){
himg.src = (himg.src.indexOf('gr_pl') != -1 ? himg.src.replace('gr_pl','gr_mn') : himg.src.replace('gr_mn','gr_pl'));
}
}

       function GC(obj)
	{
		if (obj.style.backgroundColor=='')
		{obj.style.backgroundColor='#FFFFCC';}
		else
		{obj.style.backgroundColor='';}
	}



function sel_reg(toreg)
	{
	for(i=0;i<document.getElementById('select_region').length;i++)
		{ 
		if (toreg.indexOf(document.getElementById('select_region').options[i].text)>-1 && toreg.indexOf(document.getElementById('select_region').options[document.getElementById('select_region').selectedIndex].text)<0) 
			{
			if (get_cook('chk_reg')!='true') disp('region');
			disp('btn_reg');
			disp('span_chk_reg');
			document.getElementById('chk_reg').checked=get_cook('chk_reg');
			document.getElementById('select_region').options[i].selected = true;
			}
		}

	}

function get_cook(id_obj)
{
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++)
	{
		var aCrumb = aCookie[i].split("=");
		if (id_obj == aCrumb[0]) 
		{
		return aCrumb[1];
		}
	return;
	}
}

function set_cook(id_obj,val)
{
var to = 5*365*24*60*60*1000; 
var expDate = new Date(); 
expDate.setTime(expDate.getTime() +to); 
document.cookie = id_obj + "=" + val + "; path=/; expires=" + expDate.toGMTString() ; 
}

function gr_icon_(id_icon,act)
{
	var cObs=document.getElementById(id_icon);
	var vAls=cObs.src.substr(cObs.src.indexOf(id_icon)+32,3);
	cObs.src=cObs.src.replace(id_icon+vAls,id_icon+'0'+((vAls==24 || vAls==50) ? vAls/1+1:vAls/1-1));
}

