$(document).ready(function(){

  $('<div id="portal-status"></div>').prependTo($("div#page > div.header")).css({top:"7px"});
  checkLogin();

	function checkLogin(){logged=getCookie('psessv0'); if(logged!=null && logged!=""){b=logged.split("|"); $("#portal-status").html('<a href="https://portal.stir.ac.uk/my-portal.jsp" class="portal00">My Portal</a> Welcome back <strong> '+b[2].split("_").join(" ") + '</strong>. You last logged on '+b[3].split("_").join(" ")+' <a href=\"https://portal.stir.ac.uk/security/logout.jsp" class="portal01">Log out</a>');}else{$("#portal-status").html('');}} 
	
	
	$('#slider').slider({animation_speed: 500, bg_color:'#666666', hover_color:'#7A046F', ip:imagepaths});
	
	/* Video + Fancy Box */
	/* var str = $('#vid').html();
	$("a.showvideo").fancybox({ 'hideOnContentClick': false, titlePosition:'inside', overlayColor:'#000', onComplete:function(){ $('#vid').html(str); }, onClosed:function() { } }); */
	/* Video + End Fancy Box */
	
	/*var iconOpacity = 0.6;
	$('#play-btn').css({ opacity: iconOpacity });
	$("#play-btn").hover(function() { $(this).css({ opacity: 1 }); }, function() { $(this).css({ opacity: iconOpacity }); }); */

	$('.minislider').minislider({speed: 500, controlnormalcolour: '#666', controlhovercolour: '#660066', bouncelength: 50, padding: 15, auto: true, autospeed:6000}); 
});

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
