﻿// JavaScript Document
jQuery(document).ready(function(){
	
	Hummel_slider();
	jQuery(".page_item > a").attr('title',null);
	jQuery(".post-title").attr('title',null);
	cur_page();
	sidebar_back();
	
});
function sidebar_back()
{
	jQuery('.league > ul > li').each(function(index) {
				if(jQuery(this).children('a').html()=="Armenian Premier League" || jQuery(this).children('a').html()=="Հայաստանի Բարձրագույն Լիգա")
				{
					jQuery(this).addClass("arm_league");
				}
				if(jQuery(this).children('a').html()=="UEFA Champions League" || jQuery(this).children('a').html()=="ՈՒԵՖԱ-ի Չեմպիոնների Լիգա")
				{
					jQuery(this).addClass("uefa_league");
				}
		  	});
}
function cur_page()
{	
	var k=jQuery("#cur_page").val();
	if(k!=null)
	{
		if(k=="season")
		{			
			jQuery('#menu > li').each(function(index) {
				if(jQuery(this).children('a').html()=="Season" || jQuery(this).children('a').html()=="Մրցաշրջան")
				{
					jQuery(this).addClass("current_page_item");
				}
		  	});
		}
		if(k=="news")
		{			
			jQuery('#menu > li').each(function(index) {
				if(jQuery(this).children('a').html()=="News" || jQuery(this).children('a').html()=="Նորություններ")
				{
					jQuery(this).addClass("current_page_item");
				}
		  	});
		}
		if(k=="squad")
		{			
			jQuery('#menu > li').each(function(index) {
				if(jQuery(this).children('a').html()=="Squad" || jQuery(this).children('a').html()=="Կաղմ")
				{
					jQuery(this).addClass("current_page_item");
				}
		  	});
		}
	}
}
function homeSlider() {
	var w = 748;
	var n = jQuery(".home-slider").find("ul > li").size();
	var ul_width = w*n;
	var myUl = jQuery(".home-slider .wp_bannerize_home ul");
	
	myUl.css({'width' : ul_width + "px"});
	
	jQuery(".bannerize-left").click(function() {
		clearTimeout(t);
		if( current > 0 )
		{
			current --;
			var to_left = 0 - ( current * w ) + "px";
			myUl.stop(true, false).animate({"left": to_left});
		}
		else
		{
			current = ( n - 1 )	;
			var to_left = 0 - ( current * w ) + "px";
			myUl.stop(true, false).animate({"left": to_left});
		}
		t = setTimeout("homeSliderAuto();", 5000);
	});
	
	jQuery(".bannerize-right").click(function() {
		clearTimeout(t);
		if( current < ( n - 1 ) )
		{	
			current ++;
			var to_left = 0 - ( current * w ) + "px";
			myUl.stop(true, false).animate({"left": to_left});
		}	
		else
		{
			current = 0	;
			var to_left = 0 - ( current * w ) + "px";
			myUl.stop(true, false).animate({"left": to_left});
		}	
		t = setTimeout("homeSliderAuto();", 5000);					 
	});
}

function homeSliderAuto(){
	var w = 748;
	var n = jQuery(".home-slider").find("ul > li").size();
	var ul_width = w*n;
	var myUl = jQuery(".home-slider .wp_bannerize_home ul");
	
	if( current < ( n - 1 ) )
	{	
		current ++;
		var to_left = 0 - ( current * w ) + "px";
		myUl.stop(true, false).animate({"left": to_left});
	}	
	else
	{
		current = 0	;
		var to_left = 0 - ( current * w ) + "px";
		myUl.stop(true, false).animate({"left": to_left});
	}		
	
	t = setTimeout("homeSliderAuto();", 5000);

}
var current=0;
function Hummel_slider()
{
	var h=100;
	var n = jQuery(".hum_slider").find("ul > li").size();
	var ul_h=h*n;
    var myUl=jQuery(".hum_slider ul");
	
	if(current<(n-1))
	{
		current++;
		var top = "-"+(current*h)+"px";
		myUl.stop(true, false).animate({"top": top});
	}
	else
	{
		current=0;
		var top = "-"+(current*h)+"px";
		myUl.stop(true, false).animate({"top": top});
	}
	t = setTimeout("Hummel_slider();", 5000);
}
function Vis(id , url)
{
	var k=jQuery(".info"+id+"").attr('title');
	if(k=="hide")
	{
		Show(id , url);
	}
	if(k=="show")
	{
		Hide(id , url);
	}
}
function Hide(id , url)
{
	var options={};
	jQuery(".info"+id+"").hide( 'blind', options,300 );
	jQuery(".info"+id+"").attr('title','hide');
	jQuery(".info_img"+id+"").attr('src',''+url+'/images/down.png');
}
function Show(id , url)
{
	var options={};
	jQuery(".info"+id+"").show( 'blind', options,500);
	jQuery(".info"+id+"").attr('title','show');
	jQuery(".info_img"+id+"").attr('src',''+url+'/images/up.png');
}


