function switchMenu(obj,img) {
img = img || '0';
var el = document.getElementById(obj);
if ( el.style.display != 'none' ) {
el.style.display = 'none';
setCookie(obj,0,10,'/');
if(img)
	document.getElementById(img).src ='http://animeseed.com/animeseed/images/expand.gif';
}
else {
el.style.display = '';
setCookie(obj,1,10,'/');
if(img)
	document.getElementById(img).src ='http://animeseed.com/animeseed/images/collapse.gif';
}
}

function offMenu(obj) {
var el = document.getElementById(obj);
el.style.display = 'none';
}

function onMenu(obj) {
var el = document.getElementById(obj);
el.style.display = '';
}

function setCookie(name, value, expires, path) {
var exdate=new Date()
exdate.setDate(exdate.getDate()+expires)
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + exdate.toGMTString() : "") +
      ((path) ? "; path=" + path : "");
  document.cookie = curCookie;
}

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 "empty"
}

function loadToggle() {
	var basicinfo=0,descinfo=0,miscinfo=0,reviewinfo=0,linkinfo=0,chatango=0,watchinfo=0;
	basicinfo=getCookie('basicinfo');
	descinfo=getCookie('descinfo');
	miscinfo=getCookie('miscinfo');
	reviewinfo=getCookie('reviewinfo');
	linkinfo=getCookie('linkinfo');
	chatango=getCookie('chatango');
	watchinfo=getCookie('watchinfo');
	
	if(basicinfo == 0) {
		offMenu('basicinfo');
		document.getElementById('basicbutton').src ='http://animeseed.com/animeseed/images/expand.gif';
	}
	if(descinfo == 0) {
		offMenu('descinfo');
		document.getElementById('descbutton').src ='http://animeseed.com/animeseed/images/expand.gif';
	}
	if(miscinfo == 0) {
		offMenu('miscinfo');
		document.getElementById('miscbutton').src ='http://animeseed.com/animeseed/images/expand.gif';
	}
	if(reviewinfo == 0) {
		offMenu('reviewinfo');
		document.getElementById('reviewbutton').src ='http://animeseed.com/animeseed/images/expand.gif';
	}
	if(linkinfo == 0) {
		offMenu('linkinfo');
		document.getElementById('linkbutton').src ='http://animeseed.com/animeseed/images/expand.gif';
	}
	if(chatango == 0) {
		offMenu('chatango');
		document.getElementById('chatango').src ='http://animeseed.com/animeseed/images/expand.gif';		
	}
	if(watchinfo == 0) {
		offMenu('watchinfo');
		document.getElementById('watchbutton').src ='http://animeseed.com/animeseed/images/expand.gif';				
	}
}

// Popup size depending on the type of video source

// as s1 width="440" height="350"
// youtube width="425" height="355"
// dailymotion width="425" height="335"
// clip width="448" height="361"
//var animeseed_s1_eps_dim = youtube_eps_dim = dailymotion_eps_dim = clip_eps_dim = 
//	animeseed_other_eps_dim = 'top=100, left=100,height=520,width=700,scrollbars=yes,resizable=yes';


//New window size = one size fits all


// veoh width="540" height="438" 
// megavideo width="540" height="438"
// myspace tv width="540px" height="438px"
// livemarco  width="550" height="445" 
// guba width="375px" height="360px"
// stagevu width: 504px; height: 375px
var veoh_eps_dim = megavideo_eps_dim = myspacetv_eps_dim = imeem_eps_dim = livemarco_eps_dim = 
	animeseed_s1_eps_dim = youtube_eps_dim = dailymotion_eps_dim = clip_eps_dim = animeseed_other_eps_dim =
	guba_eps_dim = stagevu_eps_dim = russian_eps_dim = facebook_eps_dim = 'top=100, left=100,height=640,width=840,scrollbars=yes,resizable=yes';


// note: name cannot have space and must be quoted when sent in
function popWin(url, name, dim)
{
	newwindow=window.open(url,name, dim);
	if (window.focus) {newwindow.focus()}
	try{
		event.returnValue=false; // for IE7
	} catch(exception) {
	}
	return false;
}

// Open a new window. - FOR GALLERY
function reqWin(desktopURL, alternateWidth, alternateHeight, noScrollbars)
{
	if ((alternateWidth && self.screen.availWidth * 0.8 < alternateWidth) || (alternateHeight && self.screen.availHeight * 0.8 < alternateHeight))
	{
		noScrollbars = false;
		alternateWidth = Math.min(alternateWidth, self.screen.availWidth * 0.8);
		alternateHeight = Math.min(alternateHeight, self.screen.availHeight * 0.8);
	}
	else
		noScrollbars = typeof(noScrollbars) != "undefined" && noScrollbars == true;

	window.open(desktopURL, 'requested_popup', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=' + (noScrollbars ? 'no' : 'yes') + ',width=' + (alternateWidth ? alternateWidth : 480) + ',height=' + (alternateHeight ? alternateHeight : 220) + ',resizable=no');

	// Return false so the click won't follow the link ;).
	return false;
}