/*                                                                           /
/                                                                            /
//      This social sidebar and social bottombar is brought to you by:      //
///                             z4zen creative                             ///
////                              10/15/2011                              ////
///                       Please leave these credits                       ///
//                        http://www.z4zen.com/zBar                         //
/                                                                            /
/                                                                           */

/* ------------------------- z4bottombar FUNCTION ------------------------- */
// SHOW-HIDE z4sidebar
$().ready(function(){
  $("div#z4sidebar-hide").click(function(){
    $("div#z4sidebar").fadeOut("fast");
	$("div#z4sidebar-show").fadeIn("fast");
	put_z4sidebar_hide();
  });
  $("div#z4sidebar-show").click(function() {										
	$("div#z4sidebar").fadeIn("fast");
	$("div#z4sidebar-show").fadeOut("fast");
	put_z4sidebar_show();
  });
});
// SHOW-HIDE z4bottombar
$().ready(function(){
  $("div#z4bottombar-hide").click(function(){
    $('div#z4bottombar').animate({ marginLeft: "110%"} , 900);
	$("div#z4bottombar-show").fadeIn("slow");
	put_z4bottombar_hide();
  });
  $("div#z4bottombar-show").click(function() {
    document.getElementById("z4bottombar").style.display = "block";										
	$('div#z4bottombar').animate({ marginLeft: "0"} , 900);
	$("div#z4bottombar-show").fadeOut("fast"); 
	put_z4bottombar_show();
  });
});
// SHOW-HIDE zMenu ON CLICK
jQuery(function( $ ) {
  var container = $( "#zMenu" );
  $( "#zMenu-link" ).click(function( event ) {
	event.preventDefault();
	if (container.is( ":visible" )) {
	  container.slideToggle( "fast");
	} else if (container.is( ":hidden" )) {
	  container.slideToggle("fast");
	}
  });
// HIDE z4bottombar IF PAGE IS CLICKED ANYWHERE
  $(document).click(function() {
	if (container.is( ":visible" )) {
	  container.slideToggle("fast");
    }
  });
// STOP zMenu FROM CLOSING AUTOMATICALLY OR IF A zMenu LINK IS CLICKED
  $('div#zMenu-link').click(function(event) { 
	event.stopPropagation();
  });
});
// GET COOKIE
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
  {
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}
// SET COOKIE
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
// COOKIE TO KEEP z4bottombar HIDDEN
function check_z4bottombar_display()
{
var z4bottombar_hide=getCookie("z4bottombar_hide");
if (z4bottombar_hide=="yes")
  {
    // alert("z4bottombar is hidden");
	document.getElementById("z4bottombar").style.margin = "0 0 0 110%";
	document.getElementById("z4bottombar").style.display = "none";
    $("div#z4bottombar-show").fadeIn("slow");
  }
else if (z4bottombar_hide=="no" || z4bottombar_hide==null || z4bottombar_hide=="")
  {
    // alert(z4bottombar_hide);
	document.getElementById("z4bottombar").style.margin = "0";
	document.getElementById("z4bottombar-show").style.display = "none";
	document.getElementById("z4bottombar").style.display = "block";
  }
}
function put_z4bottombar_hide() {
  // alert("you just hid z4bottombar");
  setCookie("z4bottombar_hide","yes",1);
}
function put_z4bottombar_show() {
  // alert("you just showed z4bottombar");
  setCookie("z4bottombar_hide","no",1);
}

// COOKIE TO KEEP z4sidebar HIDDEN
function check_z4sidebar_display()
{
var z4sidebar_hide=getCookie("z4sidebar_hide");
if (z4sidebar_hide=="yes")
  {
    // alert("z4sidebar is hidden");
	document.getElementById("z4sidebar-show").style.display = "block";
	document.getElementById("z4sidebar").style.display = "none";
  }
else if (z4sidebar_hide=="no" || z4sidebar_hide==null || z4sidebar_hide=="")
  {
    // alert(z4sidebar_hide);
	document.getElementById("z4sidebar-show").style.display = "none";
	document.getElementById("z4sidebar").style.display = "block";
  }
}
function put_z4sidebar_hide() {
  // alert("you just hid z4sidebar");
  setCookie("z4sidebar_hide","yes",1);
}
function put_z4sidebar_show() {
  // alert("you just showed z4sidebar");
  setCookie("z4sidebar_hide","no",1);
}
