// открывает новое окно
function MM_openBrWindow(theURL,winName,features) {
	winName = '_blank'; 
	if ( features == '' ) {
		window.open(theURL,winName);
	} else { 
		window.open(theURL,winName,features);  
	}

}

function OpenDialog(href,width,height) {
	  var left, top;
	  top  = Math.floor((screen.height - height)/2-14);
	  left = Math.floor((screen.width - width)/2-5);
	  window.open(href,'','scrollbars=no,resizable=no,width='+width+',height='+height+',left='+left+',top='+top);
}
function OpenDialog2(href,width,height) {
	  var left, top;
	  top  = Math.floor((screen.height - height)/2-14);
	  left = Math.floor((screen.width - width)/2-5);
	  window.open(href,'','scrollbars=yes,resizable=no,width='+width+',height='+height+',left='+left+',top='+top);
}

// редирект
function Redirect2(href)
{	
	// Fix Mozilla bug: 209020
	if ( navigator.product == 'Gecko' )
	{
		navstring = navigator.userAgent.toLowerCase();
		geckonum  = navstring.replace( /.*gecko\/(\d+)/, "$1" );

		setTimeout("moz_redirect()",1);
	} else moz_redirect()

	function moz_redirect()
	{
		var url_bit     = "/conference/"+href+".php#messages";
		window.location = url_bit.replace( new RegExp( "&amp;", "g" ) , '&' );
	}
}

$(document).ready(function(){
	/* Обработка выпадающего списка на jQuery  */
	$(".jqSelect").click(function(){
		var pos = $(this).position();
		var nWidth = $(this).innerWidth();
		var nLeft = pos.left;
		var nTop = pos.top + 19;		
		var items = $(this).next(".jqSelItems");
		//nWidth = nWidth - ($(items).innerWidth() - $(items).width());
		$(items).css({width: nWidth, top: nTop, left: nLeft});
		var visible =$(items).css("display");
		if (visible == 'block') {
			//$(".jqSelItems:visible").hide();
			$(items).hide();
		} else {
			$(".jqSelItems:visible").hide();
			$(items).show();
		}
	});
	$(".jqSelItem").click(function(){
		var key = $(this).attr("rel");
		var val = $(this).html();
		$(this).parent().parent().find(".jqSelect-value").val(key);
		$(this).parent().parent().find(".jqSelect-inputbox").val(val);
		$(this).parent().hide();
	});
	/* /Обработка выпадающего списка на jQuery  */
	

	/* для inputbox при клике стираем значения по умолчанию... (У элемента должен быть указан ID) */
	
	
	/*var hasCanged = [];
	$(".inputbox").click(function(){
		var id = $(this).attr("id");
		if ( hasCanged[id] != 1 ) {
			$(this).val("");
			hasCanged[id] = 1;
		}
	});
*/

});

