// Author : Rio Husnady Hidayat | spiderio
// DO NOT USE THIS SCRIPT WITHOUT PERMISSION!
var menuaray=new Array("ul.menu_00","ul.menu_01","ul.menu_02","ul.menu_03","ul.menu_04","ul.menu_05","ul.menu_06","ul.menu_07","ul.menu_08","ul.menu_09","ul.menu_10","ul.menu_11","ul.menu_12");function hilangkansemua(){for(i=0;i<13;i++)
{$(menuaray[i]).hide();}};

$(document).ready(function() {
	//coba cara ganti-ganti themes $('#switcher').themeswitcher();
	$('a.menu_00').hover(function(){hilangkansemua()});$('a.menu_01').hover(function(){hilangkansemua()
	$('ul.menu_01').show();});$('a.menu_02').hover(function(){hilangkansemua()
	$('ul.menu_02').show();});$('a.menu_03').hover(function(){hilangkansemua()
	$('ul.menu_03').show();});$('a.menu_04').hover(function(){hilangkansemua()
	$('ul.menu_04').show();});$('a.menu_05').hover(function(){hilangkansemua()
	$('ul.menu_05').show();});$('a.menu_06').hover(function(){hilangkansemua()
	$('ul.menu_06').show();});$('a.menu_07').hover(function(){hilangkansemua()
	$('ul.menu_07').show();});$('a.menu_08').hover(function(){hilangkansemua()
	$('ul.menu_08').show();});$('a.menu_09').hover(function(){hilangkansemua()
	$('ul.menu_09').show();});$('a.menu_10').hover(function(){hilangkansemua()
	$('ul.menu_10').show();});$('a.menu_11').hover(function(){hilangkansemua()
	$('ul.menu_11').show();});$('a.menu_12').hover(function(){hilangkansemua()
	$('ul.menu_12').show();});			
	$("#pikame").PikaChoose({show_captions:true,auto_play:true,thumb_width:45,thumb_height:35});
	$("#pikame2").PikaChoose({show_captions:false,auto_play:false,thumb_width:45,thumb_height:35});
	$('#icos a').hover(function() {
		$('.io-redaksi a').css({'background-color' : '#eee'});
		$('.io-kolom a').css({'background-color' : '#eee'});
		$('.io-wawancr a').css({'background-color' : '#eee'});
		$('.io-lip_pilihan a').css({'background-color' : '#eee'});
		$(this).css({'background-color' : 'yellow'});
		var url = $(this).attr('rel');
		$('.isi_tabs').load(url);
		return false;
	});

});

$(function(){
		
				// Accordion
				$("#accordion").accordion({ header: "h2", event: "mouseover" });
	
				// Tabs
				$('#headline').tabs().tabs('rotate', 5800);
				$('#tabs').tabs().tabs('rotate', 4660);
				$('#weathertab').tabs({ event: 'mouseover' });
				$('#mudik').tabs({ event: 'mouseover' }).tabs('rotate', 4000);
				$('#programtab').tabs({ event: 'mouseover' }).tabs('rotate', 4000);
				$('#programtab2').tabs({ event: 'mouseover' }).tabs('rotate', 4000);
				$('#programtab3').tabs({ event: 'mouseover' }).tabs('rotate', 4650);
				$('#programtab4').tabs({ event: 'mouseover' }).tabs('rotate', 4000);
				$('#lip6indexbox').tabs({});
				$('#vidrighttab').tabs({ event: 'mouseover' });
				// Dialog
				$('#breaking').click(function() {$('#dialog').dialog('open');	});

				$('#dialog').dialog({
					autoOpen: false,
					width: 600,
					height: 400
				});
				// Dialog Link
				$('#dialog_link').click(function(){
					$('#dialog').dialog('open');
					return false;
				});
				
				$('#dialog2').dialog({
					autoOpen: false,
					resizable: false,
					width: 670,
					height: 560
				});
				// Dialog Link
				$('#karikatur').click(function(){
					$('#dialog2').dialog('open');
					return false;
				});
				
/* Datepicker		$('#datepicker').datepicker({inline: true}); Slider	$('#slider').slider({range: true,values: [17, 67]});  hover states on the static widgets
				$('#dialog_link, ul#icons li').hover(	function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); });*/
				
});

//HEADLINE SPIDERIO
var featuredcontentglider={csszindex:100,ajaxloadingmsg:'<b>Memuat Content. Harap Tunggu...</b>',glide:function(config,showpage,isprev){var selected=parseInt(showpage)
if(selected>=config.$contentdivs.length){alert("Tidak ada content pada page "+(selected+1)+"! Memuat page pertama")
selected=0}
var $target=config.$contentdivs.eq(selected)
if(config.$togglerdiv.attr('lastselected')==null||parseInt(config.$togglerdiv.attr('lastselected'))!=selected){var $selectedlink=config.$toc.eq(selected)
config.$next.attr('loadpage',(selected<config.$contentdivs.length-1)?selected+1+'pg':0+'pg')
config.$prev.attr('loadpage',(selected==0)?config.$contentdivs.length-1+'pg':selected-1+'pg')
var startpoint=(isprev=="previous")?-config.startpoint:config.startpoint
$target.css(config.leftortop,startpoint).css("zIndex",this.csszindex++)
var endpoint=(config.leftortop=="left")?{left:0}:{top:0}
$target.css(endpoint).css({opacity:0}).animate({opacity:1}, config.speed)
config.$toc.removeClass('aselected')
$selectedlink.addClass('aselected')
config.$togglerdiv.attr('lastselected',selected+'pg')}},getremotecontent:function(config){config.$glider.html(this.ajaxloadingmsg)
$.ajax({url:config.remotecontent,error:function(ajaxrequest){config.$glider.html('Error fetching content.<br />Server Response: '+ajaxrequest.responseText)},success:function(content){config.$glider.html(content)
featuredcontentglider.setuptoggler(config)}})},aligncontents:function(config){config.$contentdivs=$("#"+config.gliderid+" ."+config.contentclass)
config.$contentdivs.css(config.leftortop,config.startpoint).css({height:config.$glider.height(),visibility:'visible'})},setuptoggler:function(config){this.aligncontents(config)
config.$togglerdiv.hide()
config.$toc.each(function(index){$(this).attr('pagenumber',index+'pg')
if(index>(config.$contentdivs.length-1))
$(this).css({display:'none'})})
var $nextandprev=$("#"+config.togglerid+" .next, #"+config.togglerid+" .prev")
$nextandprev.click(function(event){featuredcontentglider.glide(config,this.getAttribute('loadpage'),this.getAttribute('buttontype'))
event.preventDefault()})
config.$toc.click(function(event){featuredcontentglider.glide(config,this.getAttribute('pagenumber'))
event.preventDefault()})
config.$togglerdiv.fadeIn(1000,function(){featuredcontentglider.glide(config,config.selected)
if(config.autorotate==true){config.stepcount=0
config.totalsteps=config.$contentdivs.length*config.autorotateconfig[1]
featuredcontentglider.autorotate(config)}})
config.$togglerdiv.click(function(){featuredcontentglider.cancelautorotate(config.togglerid)})},autorotate:function(config){var rotatespeed=config.speed+config.autorotateconfig[0]
window[config.togglerid+"timer"]=setInterval(function(){if(config.totalsteps>0&&config.stepcount>=config.totalsteps){clearInterval(window[config.togglerid+"timer"])}
else{featuredcontentglider.glide(config,config.$next.attr('loadpage'));config.stepcount++}},rotatespeed)},cancelautorotate:function(togglerid){if(window[togglerid+"timer"])
clearInterval(window[togglerid+"timer"])},getCookie:function(Name){var re=new RegExp(Name+"=[^;]+","i")
if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return null},setCookie:function(name,value){document.cookie=name+"="+value},init:function(config){$(document).ready(function(){config.$glider=$("#"+config.gliderid)
config.$togglerdiv=$("#"+config.togglerid)
config.$toc=config.$togglerdiv.find('.toc')
config.$next=config.$togglerdiv.find('.next')
config.$prev=config.$togglerdiv.find('.prev')
config.$prev.attr('buttontype','previous')
var selected=(config.persiststate)?featuredcontentglider.getCookie(config.gliderid):config.selected
config.selected=(isNaN(parseInt(selected)))?config.selected:selected
config.leftortop=(/up/i.test(config.direction))?"top":"left"
config.heightorwidth=(/up/i.test(config.direction))?config.$glider.height():config.$glider.width()
config.startpoint=(/^(left|up)/i.test(config.direction))?-config.heightorwidth:config.heightorwidth
if(typeof config.remotecontent!="undefined"&&config.remotecontent.length>0)
featuredcontentglider.getremotecontent(config)
else
featuredcontentglider.setuptoggler(config)
$(window).bind('unload',function(){config.$togglerdiv.unbind('click')
config.$toc.unbind('click')
config.$next.unbind('click')
config.$prev.unbind('click')
if(config.persiststate)
featuredcontentglider.setCookie(config.gliderid,config.$togglerdiv.attr('lastselected'))
config=null})})}};
//HEADLINE SPIDERIO
/* jQuery plugin themeswitcher
---------------------------------------------------------------------*/
$.fn.themeswitcher=function(settings){var options=jQuery.extend({loadTheme:null,initialText:'Switch Theme',width:150,height:200,buttonPreText:'Theme: ',closeOnSelect:true,buttonHeight:14,cookieName:'jquery-ui-theme',onOpen:function(){},onClose:function(){},onSelect:function(){}},settings);var button=$('<a href="#" class="jquery-ui-themeswitcher-trigger"><span class="jquery-ui-themeswitcher-icon"></span><span class="jquery-ui-themeswitcher-title">'+options.initialText+'</span></a>');var switcherpane=$('<div class="jquery-ui-themeswitcher"><div id="themeGallery"><ul><li><a href="css/ui-darkness/jquery-ui.css"><img src="images/ui_dark.png" alt="UI Darkness" title="UI Darkness" /><span class="themeName">UI darkness</span></a></li><li><a href="css/smoothness/jquery-ui.css"><img src="images/smoothness.png" alt="Smoothness" title="Smoothness" /><span class="themeName">Smoothness</span></a></li></ul></div></div>').find('div').removeAttr('id');button.click(function(){if(switcherpane.is(':visible')){switcherpane.spHide();}
else{switcherpane.spShow();}
return false;});switcherpane.hover(function(){},function(){if(switcherpane.is(':visible')){$(this).spHide();}});$.fn.spShow=function(){$(this).css({top:button.offset().top+options.buttonHeight+6,left:button.offset().left}).slideDown(50);button.css(button_active);options.onOpen();}
$.fn.spHide=function(){$(this).slideUp(50,function(){options.onClose();});button.css(button_default);}
switcherpane.find('a').click(function(){updateCSS($(this).attr('href'));var themeName=$(this).find('span').text();button.find('.jquery-ui-themeswitcher-title').text(options.buttonPreText+themeName);$.cookie(options.cookieName,themeName);options.onSelect();if(options.closeOnSelect&&switcherpane.is(':visible')){switcherpane.spHide();}
return false;});function updateCSS(locStr){var cssLink=$('<link href="'+locStr+'" type="text/css" rel="Stylesheet" class="ui-theme" />');$("head").append(cssLink);if($("link.ui-theme").size()>3){$("link.ui-theme:first").remove();}}
var button_default={fontFamily:'Trebuchet MS, Verdana, sans-serif',fontSize:'11px',color:'#666',background:'#eee url(images/buttonbg.png) 50% 50% repeat-x',border:'1px solid #ccc','-moz-border-radius':'6px','-webkit-border-radius':'6px',textDecoration:'none',padding:'3px 3px 3px 8px',width:options.width-11,display:'block',height:options.buttonHeight,outline:'0'};var button_hover={'borderColor':'#bbb','background':'#f0f0f0',cursor:'pointer',color:'#444'};var button_active={color:'#aaa',background:'#000',border:'1px solid #ccc',borderBottom:0,'-moz-border-radius-bottomleft':0,'-webkit-border-bottom-left-radius':0,'-moz-border-radius-bottomright':0,'-webkit-border-bottom-right-radius':0,outline:'0'};button.css(button_default).hover(function(){$(this).css(button_hover);},function(){if(!switcherpane.is(':animated')&&switcherpane.is(':hidden')){$(this).css(button_default);}}).find('.jquery-ui-themeswitcher-icon').css({float:'right',width:'16px',height:'16px',background:'url(images/icon_color_arrow.gif) 50% 50% no-repeat'});switcherpane.css({position:'absolute',float:'left',fontFamily:'Trebuchet MS, Verdana, sans-serif',fontSize:'12px',background:'#000',color:'#fff',padding:'8px 3px 3px',border:'1px solid #ccc','-moz-border-radius-bottomleft':'6px','-webkit-border-bottom-left-radius':'6px','-moz-border-radius-bottomright':'6px','-webkit-border-bottom-right-radius':'6px',borderTop:0,zIndex:999999,width:options.width-6}).find('ul').css({listStyle:'none',margin:'0',padding:'0',overflow:'auto',height:options.height}).end().find('li').hover(function(){$(this).css({'borderColor':'#555','background':'url(images/menuhoverbg.png) 50% 50% repeat-x',cursor:'pointer'});},function(){$(this).css({'borderColor':'#111','background':'#000',cursor:'auto'});}).css({width:options.width-30,height:'',padding:'2px',margin:'1px',border:'1px solid #111','-moz-border-radius':'4px',clear:'left',float:'left'}).end().find('a').css({color:'#aaa',textDecoration:'none',float:'left',width:'100%',outline:'0'}).end().find('img').css({float:'left',border:'1px solid #333',margin:'0 2px'}).end().find('.themeName').css({float:'left',margin:'3px 0'}).end();$(this).append(button);$('body').append(switcherpane);switcherpane.hide();if($.cookie(options.cookieName)||options.loadTheme){var themeName=$.cookie(options.cookieName)||options.loadTheme;switcherpane.find('a:contains('+themeName+')').trigger('click');}
return this;};

/**
 * Cookie plugin
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 */
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};

/* pika */
jQuery.iPikaChoose={build:function(user_options)
{var user_options;var defaults={show_captions:true,slide_enabled:true,auto_play:true,show_prev_next:true,slide_speed:5000,thumb_width:50,thumb_height:42,buttons_text:{play:"Play",stop:"Berhenti",previous:"<span class='ui-icon ui-icon-seek-prev'/>",next:"<span class='ui-icon ui-icon-seek-next'/>"},delay_caption:true,user_thumbs:false};return jQuery(this).each(function(){var options=jQuery.extend(defaults,user_options);var images=jQuery(this).children('li').children('img');images.fadeOut(1);var ulist=jQuery(this);images.each(LoadImages);jQuery(this).before("<div class='pika_main'></div>");var main_div=jQuery(this).prev(".pika_main");if(options.slide_enabled){main_div.append("<div class='pika_play'></div>");var play_div=jQuery(this).prev(".pika_main").children(".pika_play");play_div.html("<a class='pika_play_button'>"+options.buttons_text.play+"</a><a class='pika_stop_button'>"+options.buttons_text.stop+"</a>");play_div.fadeOut(1);var play_anchor=play_div.children('a:first');var stop_anchor=play_div.children('a:last');}
main_div.append("<div class='pika_subdiv'></div>");var sub_div=main_div.children(".pika_subdiv");sub_div.append("<img />");var main_img=sub_div.children("img");if(options.show_captions){sub_div.append("<div class='pika_caption'></div>");var caption_div=sub_div.children(".pika_caption");}
jQuery(this).after("<div class='pika_navigation'></div>");var navigation_div=jQuery(this).next(".pika_navigation");navigation_div.prepend("<a class='fkiri'>"+options.buttons_text.previous+"</a>  <a class='fknn' style='margin-right:4px;'>"+options.buttons_text.next+"</a><div class='clear'></div>");var previous_image_anchor=navigation_div.children('a:first');var next_image_anchor=navigation_div.children('a:last');if(!options.show_prev_next){navigation_div.css("display","none");}
var playing=options.auto_play;main_img.wrap("<a></a>");var main_link=main_img.parent("a");function LoadImages()
{jQuery(this).bind("load",function()
{var w=jQuery(this).width();var h=jQuery(this).height();if(w===0){w=jQuery(this).attr("width");}
if(h===0){h=jQuery(this).attr("height");}
var rw=options.thumb_width/w;var rh=options.thumb_height/h;if(rw<rh){var ratio=rh;var left=((w*ratio-options.thumb_width)/2)*-1;left=Math.round(left);jQuery(this).css({left:left});}else{var ratio=rw;var top=0;jQuery(this).css({top:top});}
var width=Math.round(w*ratio);var height=Math.round(h*ratio);jQuery(this).css("position","relative");jQuery(this).width(width).height(height);var imgcss={width:width,height:height};jQuery(this).css(imgcss);jQuery(this).hover(function(){jQuery(this).fadeTo(250,1);},function(){if(!jQuery(this).hasClass("pika_selected")){jQuery(this).fadeTo(250,0.4);}});jQuery(this).fadeTo(250,0.4);if(jQuery(this).hasClass('pika_first')){jQuery(this).trigger("click",["auto"]);}});var newImage=jQuery(this).clone(true).insertAfter(this);jQuery(this).remove();images=ulist.children('li').children('img');}
function activate()
{images.bind("click",image_click);if(options.slide_enabled){if(options.auto_play){playing=true;play_anchor.hide();stop_anchor.show();}else{play_anchor.show();stop_anchor.hide();}}
images.filter(":last").addClass("pika_last");images.filter(":first").addClass("pika_first");var licss={width:options.thumb_width+"px",height:options.thumb_height+"px","list-style":"none",overflow:"hidden"};images.each(function(){jQuery(this).parent('li').css(licss);if(jQuery(this).attr('complete')==true&&jQuery(this).css('display')=="none")
{jQuery(this).css({display:'inline'});}});previous_image_anchor.bind("click",previous_image);next_image_anchor.bind("click",next_image);}
function image_click(event,how){if(how!="auto"){if(options.slide_enabled){stop_anchor.hide();play_anchor.show();playing=false;}
main_img.stop();main_img.dequeue();if(options.show_captions)
{caption_div.stop();caption_div.dequeue();}}
if(options.user_thumbs)
{var image_source=jQuery(this).attr("ref");}else
{var image_source=jQuery(this).attr("src");}
var image_link=jQuery(this).attr("ref");var image_caption=jQuery(this).next("span").html();images.filter(".pika_selected").fadeTo(250,0.4);images.filter(".pika_selected").removeClass("pika_selected");jQuery(this).fadeTo(250,1);jQuery(this).addClass("pika_selected");if(options.show_captions)
{if(options.delay_caption)
{caption_div.fadeTo(800,0);}
caption_div.fadeTo(500,0,function(){caption_div.html(image_caption);caption_div.fadeTo(800,1);});}
main_img.fadeTo(500,0.05,function(){main_img.attr("src",image_source);main_link.attr("href",image_link);main_img.fadeTo(800,1,function(){if(playing){jQuery(this).animate({top:0},options.slide_speed,function(){if(playing){next_image_anchor.trigger("click",["auto"]);}});}});});}
function next_image(event,how){if(images.filter(".pika_selected").hasClass("pika_last")){images.filter(":first").trigger("click",how);}else{images.filter(".pika_selected").parent('li').next('li').children('img').trigger("click",how);}}
function previous_image(event,how){if(images.filter(".pika_selected").hasClass("pika_first")){images.filter(":last").trigger("click",how);}else{images.filter(".pika_selected").parent('li').prev('li').children('img').trigger("click",how);}}
function play_button(){main_div.hover(function(){play_div.fadeIn(400);},function(){play_div.fadeOut(400);});play_anchor.bind("click",function(){main_img.stop();main_img.dequeue();if(options.show_captions)
{caption_div.stop();caption_div.dequeue();}
playing=true;next_image_anchor.trigger("click",["auto"]);jQuery(this).hide();stop_anchor.show();});stop_anchor.bind("click",function(){playing=false;jQuery(this).hide();play_anchor.show();});}
if(options.slide_enabled){play_button();}
activate();});}};jQuery.fn.PikaChoose=jQuery.iPikaChoose.build;