$(document).ready(function(){
    $('#multi-ddm').dropDownMenu({parentMO: 'parent-hover', childMO: 'child-hover1'});
    getOnline();
    $('.blank').attr('target','_blank');
    $('#printThis').click(function(){window.print();return false;});
    //---Slide_menu
	var broswer = navigator.userAgent;
	var ie = (broswer.indexOf("MSIE") != -1 && broswer.indexOf(") ") == -1 ? true : false);
	if(!ie){
		$("#slide").css({"position":"absolute"});
		sw = parseInt($("#slide").css("width"));
		$("#slide").css({"position":"relative"});
		if(sw>2000)$("#slide").html($("#slide").html());
			else{
				if(sw>0){
					end = Math.ceil(2000/sw);
					bufor = "";
					for(i=0;i<end;i++)bufor += $("#slide").html();
					$("#slide").html(bufor);
				}
			}
	}else{
		buforIE = $("#slide").html();
		$("#slide").html('');
		$("#slide").append('<div style="display:inline;"><div id="slideIE">'+buforIE+'</div></div>');
		$("#slide").css({"position":"absolute"});
		sw = parseInt($("#slideIE").css("width"));
		$("#slide").css({"position":"relative"});
		if(sw>2000)$("#slideIE").html(buforIE);
			else{
				if(sw>0){
					end = Math.ceil(2000/sw);
					bufor = "";
					for(i=0;i<end;i++)bufor += buforIE;
					$("#slide").html(bufor);
				}
			}
	}
	var xt = parseInt((sw/55)*1000);
	slideMenu(xt);
	/*
	$("#slide").mouseenter(function(){$(this).stop();});
	$("#slide").mouseleave(function(){
		$("#slide").animate({left:"-"+sw+"px"},xt,"linear",function(){
			window.setTimeout("slideMenu("+xt+")",0);
		});	
	});
	*/
	/*menu...*/
	//var ex = new Array();
	//var exi = 0;
	$('div[class^="menuLeft"]').click(function(){
			var op = $(this).attr('class');
			$("#"+op).slideToggle();
			
	});
	/*
	$('.menuLeftExpand').click(function(){
		var op = $(this).attr('id');
		$("div[id^=\""+op+"_\"]").slideToggle();
		$('#'+op).fadeOut();
		ex[exi++] = '#'+op; 
	});*/
	//---
	$('ul[id^="menuUL"]').each(function(){
		var $a = $(this).children();
		var hide = true;
		var id = $(this).attr('id');
		var nr = id.substring(6);
		$a.each(function(){
				if($(this).html().indexOf("activ")>0)hide=false;
		});
		if(!hide)$('div[id^="menuLeft'+nr+'"]').removeClass('hide');
		
	});
});

function slideMenu(t){
	$("#slide").animate({left:"0px"},0,function(){
		$("#slide").animate({left:"-"+sw+"px"},t,"linear",function(){
			window.setTimeout("slideMenu("+t+")",0);
		});
	});
}

function getOnline(){
	$('#onLine').load('index.php?self=true&mod=online',{'online':'yes'});
	$('#count').load('index.php?self=true&mod=online',{'count':'yes'});
	//window.setTimeout("getOnline()",3*(1000*60));
}
//-----
function checkMail(word){
	var mail	= /.*@.*\..*/;
	var space	= /\s/g;
	var st	= mail.test(word);
	var sp	= space.test(word);
	if(st===true && sp===false)return true;
		else return false;
}

function checkPhone(word){
	var nonWord     = new RegExp("[:'\".,<>?~`!@#$%^&*()_+|={};']",'g');
	var nonN	= /[\[\]]/g;
	var decimal	= new RegExp("[0-9]",'g');
	var alphaNum	= /[a-zA-Z]/g;
	var t0	= nonWord.test(word);
	var t1	= decimal.test(word);
	var t2	= nonN.test(word);
	var t3	= alphaNum.test(word);
	if(!t0 && t1 && !t2 && !t3)return true;
		else return false;
}

function checkPlace(word){
	//var decimal	= new RegExp("[0-9]",'g');
	var nonWord     = new RegExp("[:'\".<>?~`!@#$%^&*()_+|={};']",'g');
	var nonN	= /[\[\]]/g;
	/*var t0		= decimal.test(word);*/
	var t1		= nonN.test(word);
	var t2		= nonWord.test(word);
	if(/*!t0 &&*/ !t1 && !t2)return true;
		else return false;
}

function checkPerson(word){
	var nonWord     = new RegExp("[:'\".,<>?~`!@#$%^&*()_+|={};'\\/-]",'g');
	var nonN	= /[\[\]]/g;
	var decimal	= new RegExp("[0-9]",'g');
	var t0		= nonWord.test(word);
	var t1		= decimal.test(word);
	var t2		= nonN.test(word);
	if(!t0 && !t1 && !t2)return true;
		else return false;
}
