
//var from_logo = false;
var d = document;

var img = "/images/loading.gif";
var img_width = 32;
var img_height = 32;
var msg = "Обработка данных";
var title = "Обработка";

function hide_email( user, domain, title )
{
	if ( title == '' ) {
		title = user + "&#64;" + domain;
	}

	d.write("<a href=ma"+"il"+"to&#58;" + user + "&#64;" + domain + ">" + title + "</a>");
}

function Show( id )
{
	d.getElementById( id ).style.display='block';
}

function Hide( id )
{
	d.getElementById( id ).style.display='none';
}

function Toggle( id )
{
	if ( d.getElementById( id ).style.display == 'none' ) {
		//d.getElementById( id ).style.display='block';
		d.getElementById( id ).style.display='';
		return 1;
	} else {
		d.getElementById( id ).style.display='none';
		return 0;
	}
}

function ShowLoading( id ) {
	d.getElementById( id ).innerHTML = '<img src="' + img + '" width=' + img_width + ' height=' + img_height + ' alt="' + title + '" title="' + title + '" /><div class=fs9>' + msg + '</div>';
}

function ConfirmAction( message ) {
	var result = window.confirm( message );
	return result;
}

function openNewWindow(myURL, my_width, my_height)
{
	myNewWindow=window.open(
							myURL,
							'sample',
							'toolbar=no,bar=no,location=no,status=no,menubar=no,scrollbars=yes ,resizable=no ,width='+my_width+',height='+my_height+',top=10,left=20'
						);
}

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL, winName, features);
}

function setCurrentDate( elem_id, offset ) {
	var cur_date;
	var prev_month = false;

	if ( today.getDate() == 1 ) {
		prev_month = true;
	}

	if (today.getDate() < 10)
		cur_date = "0" + today.getDate();
	else
		cur_date = today.getDate();

	cur_date = cur_date + "-";

	if ( today.getMonth() < 9 ) {
		cur_date = cur_date + "0" + (today.getMonth()+1);
	} else {
		cur_date = cur_date + (today.getMonth()+1);
	}

	elem_id.value = cur_date + "-" + today.getFullYear();
}

function IncrementField( id ) {
	var res = d.getElementById( id ).value - 0 + 1;
	d.getElementById( id ).value = res;
}

function DecrementField( id, min ) {
	var res = d.getElementById( id ).value - 1;

	if ( res < min ) {
		d.getElementById( id ).value = min;
	} else {
		d.getElementById( id ).value = res;
	}
}

function Search() {
	if ( d.getElementById( 'keyword' ).value != '' ) {
		xajax_Search( d.getElementById( 'keyword' ).value );

	} else {
		alert( 'Укажите слова для поиска!' );
	}

	return false;
}

function inputSelect(obj){
	obj.select();
}

function clearSearchString(){
	var control = document.getElementById('keywords');

	if (control.value == 'Поиск')
		control.value = '';
}

function doSearch(){
	var control = document.getElementById('keywords');

	if  (control.value != '' && control.value != 'Поиск'){
		var form = document.getElementById('aspnetForm');
		form.submit();
	}
}

function showVideo( type, video, preview )
{
	var vobj;

	vobj = new SWFObject("/libs/flash/player.swf","ply","576","358","9","#FFFFFF");
	vobj.addParam("wmode","transparent");
	vobj.addParam("allowfullscreen","false");
	vobj.addParam("allowscriptaccess","always");

	if ( type == 'about' ) {
		vobj.addParam("flashvars","&file=/media/video/about.flv&image=/media/video/about.jpg&autostart=true");

	} else if ( type == 'agency' ) {
		vobj.addParam("flashvars","&file=/media/video/short.flv&image=/images/agency_b.gif&autostart=true");

	} else if ( type == 'builders' ) {
		vobj.addParam("flashvars","&file=/media/video/short.flv&image=/images/builders_b.gif&autostart=true");

	} else if ( type == 'object' ) {
		vobj.addParam("flashvars","&file="+ video +"&image="+ preview +"&autostart=true");
	}

	vobj.write("video_player");
}
//---

