jQuery.noConflict();

/**
 * close 'DIV' elements
 */
function closeDiv(id) {
	if (jQuery("#"+id)) {
		jQuery("#"+id).slideUp("normal");
	}
}

/**
 * top menu function, adds active class, to particular menu element
 */
function topmenu(){
	//var parentMenu = jQuery('#top-menu a');
	jQuery('#top-menu a').mouseenter(function(){
		//top-menu
		jQuery('#top-menu a.active').removeClass('active');
		jQuery('#sub-menu ul.active').removeClass('active');
		jQuery('#sub-menu .sub-menu-list').removeClass('active');
		
		var subMenu = '#'+jQuery(this).attr('rel');
		jQuery(this).addClass('active');
		if(subMenu.length > 2){
			jQuery('#sub-menu').find(subMenu).addClass('active');
		}		
	});
	jQuery('#sub-menu a').mouseenter(function(){
		if(!jQuery(this).parent().parent().parent().parent().is('.sub-menu-list')){
			jQuery('#sub-menu .sub-menu-list').removeClass('active');
		}
		if(jQuery(this).next().is('.sub-menu-list')){
			jQuery(this).next().addClass('active');
		}
	});
	jQuery('#sub-menu .sub-menu-list-in table').mouseleave(function(){
		jQuery('#sub-menu .sub-menu-list').removeClass('active');
	});
}

setInterval(function(){
	var d = new Date();
	var month=((d.getSeconds())<10)?"0"+(d.getSeconds()):(d.getSeconds());
	var month=((d.getMonth()+1)<10)?"0"+(d.getMonth()+1):(d.getMonth()+1);
	var timer=d.getDate()+"."+month+"."+d.getFullYear()+" "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();		
	jQuery('.timer').html(timer);
	
},1000);


jQuery(document).ready(topmenu);
jQuery('#registration').submit(function(e)
{
	  jQuery('.loader').show();
      var options={
    		  success: function(t)
    		  {               
    	  		jQuery('.registration_panel').html(t);
    	  		jQuery('.loader').hide();
    	  		 return false;
      		  }
      };
      jQuery('#registration').ajaxSubmit(options);   
      return false;
});



var Action=(function(){
	this.action=function(el,val){
		var value=val;
		jQuery(el).blur(function(){if(jQuery(el).val()=='') jQuery(el).val(value);});
		jQuery(el).focus(function(){jQuery(el).val('');});
		return false;
	}
});



jQuery(document).ready(function(){
	var a=new Action();
	jQuery(document).ready(function(e){	
		jQuery('#registration input[type="text"]').each(function(index,item){
			a.action(item,jQuery(item).val());	
		});
		a.action(jQuery('#registration input[type="password"]'),jQuery('#registration input[type="password"]').val());
		
	});
});
jQuery(document).ready(topmenu);
(function($) {$(function() {
    $('#scroller').show();
	$("#scroller").simplyScroll({
                    pauseOnHover:false,
                    speed:1,
		autoMode: 'loop'
	});
});
})(jQuery);


