/*
 * navbar menu
 */
jQuery(document).ready(function(){ 
	jQuery("#navbar ul.children").removeClass("children");
	jQuery("#navbar-cat ul.children").removeClass("children");
	jQuery("#navbar li, #navbar-cat li").has("ul").hover(function(){
		jQuery(this).children("ul").fadeIn('normal');
		jQuery(this).addClass('selected');
	}, function() {
		jQuery(this).children("ul").stop(true, true).css("display", "none");
		jQuery(this).removeClass('selected');
	});
	
	
	

	jQuery('.fbGall iframe').load(function(){
		jQuery('fb:like').css('background-color','red');
	});
	
	//f1ddacb522e8b4c
	//
	/*
	 * var iframe = jQuery('.fbGall iframe document');
		var css = '' +
		          '<style type="text/css">' +
		          'body{background-color:#3dff00;}' +
		          '</style>';
		iframe.open();
		iframe.write(css);
		iframe.close();	
	 */
	//var iframe = top.frames[f1ddacb522e8b4c].document;
	//var css = '' +
	//          '<style type="text/css">' +
	//          'body{margin:0;padding:0;background:transparent; text-align:right; width:100px;}' +
	//          'div#LikePluginPagelet{width:100px;}' +
	//			'div#LikePluginPagelet div.connect_widget{float:right;}' +
	//          '</style>';
	//iframe.open();
	//iframe.write(css);
	//iframe.close();

});



sfHover = function() {
   var sfEls = document.getElementById("navbar").getElementsByTagName("li");
   for (var i=0; i<sfEls.length; i++) {
      sfEls[i].onmouseover=function() {
         this.className+=" hover";
      }
      sfEls[i].onmouseout=function() {
         this.className=this.className.replace(new RegExp(" hover\\b"), "");
      }
   }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*
 * gallery
 */
jQuery(function() {       
    jQuery('#gallery').after('<div id="gallery-nav" class="gallery-nav">').cycle({
        fx:     'fade',
        speed:  'slow',
        timeout: 5000,
        pager:  '#gallery-nav'
    });
});

/*
 * cufon replace
 */
Cufon.replace('h1');
Cufon.replace('h2');
Cufon.replace('h3');
Cufon.replace('h4');
Cufon('.link-more a', {
	hover: {
		color: '#ffffff'
	}
});
Cufon.replace('#nav > ul > li > a');
Cufon('#subpage-nav li a', {
	hover: {
		color: '#ffffff'
	}
});

/*
 * close html elements
 */
function closeDiv(id) {
	document.getElementById(id).style.display = 'none';
}

