$(
	  function(){		 
	   $('newsBox').hover(function() {	   
			// Stuff that happens when you hover on + the stop()
				$('.hover', this).stop().animate({ 'opacity': 1	}, 700,'easeOutSine')
			}, function() {		
			// Stuff that happens when you unhover + the stop()
				$('.hover', this).stop().animate({	'opacity': 0 }, 700, 'easeOutQuad')		
			}
		)	   
	  }
);

$(document).ready(function(){
						   
});
						   
function toggleMenu(pDIV){	
	$("." + pDIV).slideToggle('fast');
}


function contentClose(pID, pPATH, pPAGE){
	//alert("Close");
	//$(".boxContent").toggle();
	//$(".boxContent-"+pID).slideToggle();
    if ($(".boxContent-"+pID).is(":hidden"))
    {
		$(".boxContent-"+pID).slideDown("100");			
		$(".newsButton-"+pID).attr("src", pPATH + "/images/collapseOpen.png");				
		if (!(pPAGE == 'SINGLE')){
			$("#newsHeader-"+pID).removeClass('newsHeaderClose');	
			$("#newsHeader-"+pID).addClass('newsHeader');	
		}else{
			$("#newsHeader-"+pID).removeClass('newsHeaderSingleClose');	
			$("#newsHeader-"+pID).addClass('newsHeaderSingle');				
		}
    } else {
		$(".boxContent-"+pID).slideUp("100");			
		$(".newsButton-"+pID).attr("src", pPATH + "/images/collapseClose.png");				
		if (!(pPAGE == 'SINGLE')){
			$("#newsHeader-"+pID).removeClass('newsHeader');	
			$("#newsHeader-"+pID).addClass('newsHeaderClose');	
		} else {
			$("#newsHeader-"+pID).removeClass('newsHeaderSingle');	
			$("#newsHeader-"+pID).addClass('newsHeaderSingleClose');				
		}
    }	

}

function featuredClick(pIMG,pPATH){	
	$(".featured")[0].innerHTML = "<img src='" + pPATH + "/timthumb.php?src=" + pIMG + "&amp;h=240&amp;w=618&amp;q=100&amp;zc=0'/>";
}
function callback(){
	//$(".boxContent-"+pID).addClass();
}

/* === MENU DROPDOWN == */
$(document).ready(function(){
	$("ul.topnav li").hover(function() { //When trigger is hover...

		$(this).find("ul.subnav").slideDown('fast').show();

		// Nutup dropdown menu saat parent di hover
		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			//$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			//$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	
	$(".thumb-nonactive img").hover(function(){
		// alert($(this).parent());
		$(this).parent().removeClass("thumb-nonactive");
		$(this).parent().addClass("thumb-active");		
		
		$(this).removeClass("nonactive");
		$(this).addClass("active");		
	});

	$(".thumb-nonactive img").mouseout(function(){
		$(this).parent().removeClass("thumb-active");
		$(this).parent().addClass("thumb-nonactive");	

		$(this).removeClass("active");
		$(this).addClass("nonactive");	
	});
	

});

function thumbOver(pObj){
	pObj.removeClass("thumb-nonactive");
	pObj.parent().addClass("thumb-active");		
}
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
jpHover = function() {
	var jpEls = document.getElementById("jpMenu").getElementsByTagName("LI");
	for (var i=0; i<jpEls.length; i++) {
		jpEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		jpEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" jphover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
if (window.attachEvent) window.attachEvent("onload", jpHover);

