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()+'; path=/');
   document.cookie=c_name + "=" + c_value;
}

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);
      }
   }
}

function checkCookie(){
   var username=getCookie("username");
   if (username!=null && username!=""){
      alert("Welcome again " + username);
   }else{
      username=prompt("Please enter your name:","");
      if (username!=null && username!=""){
         setCookie("username",username,365);
      }
   }
}

function getUrlVars(){
   var vars = [], hash;
   var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
   for(var i = 0; i < hashes.length; i++){
      hash = hashes[i].split('=');
      vars.push(hash[0]);
      vars[hash[0]] = hash[1];
   }
   return vars;
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (
			anchor.getAttribute("href") && ( 
			anchor.getAttribute("rel") == "external" || 
			anchor.getAttribute("rel") == "external nofollow" || 
			anchor.getAttribute("rel") == "nofollow external" )
			)
		anchor.target = "_blank";
	}
}

$(function(){
   $('#inner_menu div').mouseenter(function(){
      $(this).find('.submenu').slideDown('fast');
   }).mouseleave(function(){
      $(this).find('.submenu').slideUp('fast');
   });
});

window.onload = function(){
   $("#wizerunek").coinslider({
      width: 980,
      height: 260,
      spw: 5,
      sph: 3,
      delay: 6000,
      effect: 'random'
   });
   externalLinks();
}

