// JavaScript Document

$(document).ready(function () {
	/* MENU */
	$('#Menu-nav .menu').each(function(){
		$(this).mouseover(function() {
			$(this).removeClass().addClass("menu-hover");
		}).mouseout(function (){
			$(this).removeClass().addClass("menu");
		});
	});
	
	/* MENU END */
	/* SLIDE */
	$('#HomeContentImgList .img').each(function(){
		$(this).mouseover(function() {
			block_over( $(this) );
		}).mouseout(function (){
			//block_out( $(this) );
		});
		
		/*
		// click
		$(this).click(function(){
						   
			$('#HomeContentImgList .img-hover').each(function()
			{
				$(this).attr('class' , 'img');
				$(this).mouseover(function() {
					block_over( $(this) );
				}).mouseout(function (){
					block_out( $(this) );
				});
				block_out($(this));
			});
			
			
			//$(this).removeClass().addClass("img-hover");
			//$('#HomeContentImgList .img-hover').unbind("mouseover");
			//$('#HomeContentImgList .img-hover').unbind("mouseout");
			//$('#HomeContentImgList .img-hover').children().css("visibility","visible");
		});
		*/
	});
	
	
	/// BOXES Home
	$('#HomeContentBL .box').each(function(){
		$(this).mouseover(function() {
			$(this).attr('class','box-hover');
			$(this).contents().find('.more').css("visibility","visible");
		}).mouseout(function (){
			$(this).attr('class','box');
			$(this).contents().find('.more').css("visibility","hidden");
		});
	});
	
	/// VID BOXES
	$('#HomeVid .box').each(function(){
		$(this).mouseover(function() {
			$(this).attr('class','box-hover');
			$(this).contents().find('.more').css("visibility","visible");
		}).mouseout(function (){
			$(this).attr('class','box');
			$(this).contents().find('.more').css("visibility","hidden");
		});
	});
	
	
	Pagination();
	/// BOXES News
	$('#NewsContent .box').each(function(){
		$(this).mouseover(function() {
			$(this).attr('class','box-hover');
			$(this).contents().find('.more').css("visibility","visible");
		}).mouseout(function (){
			$(this).attr('class','box');
			$(this).contents().find('.more').css("visibility","hidden");
		});
	});
	/// BOXES News vid
	$('#NewsVid .box').each(function(){
		$(this).mouseover(function() {
			$(this).attr('class','box-hover');
			//$(this).contents().find('.more').css("visibility","visible");
		}).mouseout(function (){
			$(this).attr('class','box');
			//$(this).contents().find('.more').css("visibility","hidden");
		});
	});
	
	$('#MainContent .box').each(function()
	{
		$(this).mouseover(function() {
			$(this).attr('class','box-hover');
			//$(this).contents().find('.more').css("visibility","visible");
		}).mouseout(function (){
			$(this).attr('class','box');
			//$(this).contents().find('.more').css("visibility","hidden");
		});
	});
	$('#Nom .box').each(function(){
		$(this).mouseover(function() {
			$(this).attr('class','box-hover');
			$(this).contents().find('.more').css("visibility","visible");
		}).mouseout(function (){
			$(this).attr('class','box');
			$(this).contents().find('.more').css("visibility","hidden");
		});
	});
	
	$('#Nom .box_winner').each(function(){
		$(this).mouseover(function() {
			$(this).attr('class','box_winner_hover');
			$(this).contents().find('.more').css("visibility","visible");
		}).mouseout(function (){
			$(this).attr('class','box_winner');
			$(this).contents().find('.more').css("visibility","hidden");
		});
	});
	
	/* Nomination box MEnu*/
	/*
	$('#Nom .mc').each(function(){
		$(this).mouseover(function() {
			$(this).attr('class','mc-hover');
			//$(this).contents().find('.more').css("visibility","visible");
		}).mouseout(function (){
			//alert($(this).html());
			$(this).attr('class','mc');
			//$(this).contents().find('.more').css("visibility","hidden");
		});
	});
	*/
	/*
	$('#Nom .mc2').each(function(){
		$(this).mouseover(function() {
			$(this).attr('class','mc2-hover');
		}).mouseout(function (){
			$(this).attr('class','mc2');
		});
	});
	*/
	
});

function block_over( paramObj ){
	$('#HomeContentImgList .img').each(function()
	{
		$(this).children().each(function()
		{
			if( $(this).attr("class") == "img-pointer" ) {
				$(this).css("visibility","hidden");
			}
		});
	});
	$(paramObj).children().css("visibility","visible");
}

function block_out( paramObj ){
//	$(paramObj).children().css("visibility","hidden");
//	$(paramObj).contents().find('.img-pointer').css("visibility","hidden");
	$(paramObj).children().each(function()
	{
		if( $(this).attr("class") == "img-pointer" )
		{
			$(this).css("visibility","hidden");
		}
	});
}

function box_over( paramObj ){
	
	//$(paramObj).children().css("visibility","visible");
}

function SetSlideCont(paramStr){
	$('#HomeSlideContBig [id*="Slide_"]').each(function(){
		$(this).css('display','none');
	});
	$('#Slide_'+paramStr+'').css("display","block");
	
	//$('#Slide_'+paramStr).css("display","block");
	
}

function custom_check()
{
	$("input[id*='vote_input_']").each(function()
	{
		//$(this).attr("checked", "checked");
		var id = $(this).attr('id');
		id = id.substr(11);
		//$(this).parent().append(id);
		$("#vote_img_"+id).click(function()
		{
			custom_check_click(id);
		});
	});
}

function custome_check_clear()
{
	$("input[id*='vote_input_']").each(function()
	{
		var id = $(this).attr('id');
		id = id.substr(11);
		var src = $("#vote_img_"+id).attr('src');
		src = src.replace(/VoteCheck.png/, "VoteCheckEmpty.png");
		$("#vote_img_"+id).attr('src', src);
		$("#vote_input_"+id).attr("checked", "");
	});
}

function custom_check_click( paramID )
{
	custome_check_clear();
	var src = $("#vote_img_"+paramID).attr('src');
	if(src.search("VoteCheckEmpty.png") > -1)
	{// unchecked
		src = src.replace(/VoteCheckEmpty.png/, "VoteCheck.png");
		$("#vote_img_"+paramID).attr('src', src);
		$("#vote_input_"+paramID).attr("checked", "checked");
	}
	else
	{
		src = src.replace(/VoteCheck.png/, "VoteCheckEmpty.png");
		$("#vote_img_"+paramID).attr('src', src);
		$("#vote_input_"+paramID).attr("checked", "");
	}
}

function Pagination(){
	/*
	$('#Pagination .num').each(function(){
		$(this).mouseover(function() {
			$(this).removeClass().addClass("num-hover");
		}).mouseout(function (){
			$(this).removeClass().addClass("num");
		});		
	});
	*/
}

function ViewSybM(str){
//	alert($('#SubM'+str).attr('class'));
	if ($('#SubM'+str).attr('class') == "none"){
		
		$('#Menu [id*="SubM"]').each(function(){
			//$(this).attr('class','none');
		});
		$('#SubM'+str).attr('class','block')
	}
	else if ($('#SubM'+str).attr('class') == "block"){
		$('#SubM'+str).attr('class','none')
	}
	
}


function place_upper_flash( paramFiles, paramTypes, paramName, paramSoung, paramNationality, paramClose)
{
	var w= 620;
	var h= 400;
	var minimumFlashVersion = "10.0.22";
		
	var flashvars = {};
	paramFiles = paramFiles || "";
	paramTypes = paramTypes || "";
	paramName = paramName || "";
	paramSoung = paramSoung || "";
	paramNationality = paramNationality || "";
	paramClose = paramClose || "";
	
	
	flashvars.sFiles = escape( paramFiles);
	flashvars.sTypes = escape( paramTypes);
	flashvars.sName = escape( paramName);
	flashvars.sSong = escape( paramSoung);
	flashvars.sNationality = escape( paramNationality );
	flashvars.sClose = escape( paramClose);
	
	var params = {};
	params.menu = "false";
	params.quality = "best";
	//params.scale = "noscale";
	params.bgcolor = "000000";
	//params.wmode = "transparent";
	params.allowscriptaccess = "sameDomain";
	params.allowfullscreen = "true";
	var attributes = {};
	attributes.id = "FlashMediaTop";
	attributes.align = "middle";
	swfobject.embedSWF(template + "/flash/UniversalPlayer.swf", "UniPlayer", w, h, minimumFlashVersion, template + "/flash/playerProductInstall.swf", flashvars, params, attributes);
	//swfobject.embedSWF(template + "/flash/UniversalPlayer.swf", "UniPlayer", w, h, minimumFlashVersion, "playerProductInstall.swf", flashvars, params, attributes);
}

function place_bottom_flash( paramFiles, paramTypes, paramIds)
{
	var w= 620;
	var h= 90;
	var minimumFlashVersion = "10.0.22";
		
	var flashvars = {};
	paramFiles = paramFiles || "";
	paramTypes = paramTypes || "";
	paramIds = paramIds || "";
	
	
	flashvars.sFile = escape( paramFiles);
	flashvars.sType = escape( paramTypes);
	flashvars.sId = escape( paramIds);
	
	var params = {};
	params.menu = "false";
	params.quality = "best";
	params.bgcolor = "000000";
	params.allowscriptaccess = "sameDomain";
	params.allowfullscreen = "true";
	params.wmode = "transparent";
	var attributes = {};
	attributes.id = "FlashMediaBottom";
	attributes.align = "middle";
	swfobject.embedSWF(template + "/flash/ThumbLine.swf", "LinePlayer", w, h, minimumFlashVersion, "expressInstall.swf", flashvars, params, attributes);
}

function flashmedia_click( paramCNT, paramFlash )
{
	//alert( "flashmedia_click. CNT : "+paramCNT+" | Flash : "+paramFlash );
	if( paramFlash == 1  )
	{// UP
		flash_bottom( paramCNT );
	}
	else if( paramFlash == 2)
	{// down
		flash_top( paramCNT );
	}
}
var flash_top_timeout;
var flash_bottom_timeout;

function flash_top( paramCnt)
{
	if( typeof document.getElementById("FlashMediaTop").flash_top != "function" )
	{
		flash_top_timeout = setTimeout("flash_top( "+paramCnt+" );");
	}
	else
	{
		clearInterval(flash_top_timeout);
		//alert("flash top : "+paramCnt);
		document.getElementById("FlashMediaTop").flash_top(paramCnt);
	}
}

function flash_bottom( paramCnt)
{
	if( typeof document.getElementById("FlashMediaBottom").flash_bottom != "function" )
	{
		flash_bottom_timeout = setTimeout("flash_bottom("+paramCnt+");");
	}
	else
	{
		clearInterval(flash_bottom_timeout);
		//alert("flash bottom : "+paramCnt);
		document.getElementById("FlashMediaBottom").flash_bottom(paramCnt);
	}
}



function vote_button_flash( paramType, paramUrl, paramFile)
{
	var w= 300;
	var h= 250;
	var minimumFlashVersion = "10.0.22";
		
	var flashvars = {};
	paramType = paramType || "";
	paramUrl = paramUrl || "";
	paramFile = paramFile || "";
	
	flashvars.sLink = escape( paramUrl);
	flashvars.sType = escape( paramType );
	flashvars.sUrl = escape( paramFile);
	
	var params = {};
	params.menu = "false";
	params.quality = "best";
	params.bgcolor = "000000";
	params.allowscriptaccess = "sameDomain";
	params.allowfullscreen = "true";
	params.wmode = "transparent";
	var attributes = {};
	attributes.id = "FlashMediaBottom";
	attributes.align = "middle";
	swfobject.embedSWF(template + "/flash/voting.swf", "VoteButton", w, h, minimumFlashVersion, "expressInstall.swf", flashvars, params, attributes);
}

function facebook_share()
{
	var url = window.location;
	var title = document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(url)+'&t='+encodeURIComponent(title),'sharer','toolbar=0,status=0,width=626,height=436');
}

function facebook_fan()
{
	var group_url = 'http://www.facebook.com/pages/BALKANIKA-MUSIC-TELEVISION/406428226110?ref=search&sid=758734199.3810022256..1';
	window.open(group_url, '_blank');
	newWindow.focus();
	return false;
}
