function openWindow(url,name,width,height) 
{	
var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";	
new_window = window.open(url, name, options);	
window.self.name = "main";
new_window.focus();
}

function startMediaOld(mediaNumber) 
{
var name = "MediaPlayer";
var options = "width=700,height=430,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no";

if(mediaNumber == null) { 
	var url = "../mediaplayer/media.php";
	} else	{	
var url = "../mediaplayer/media.php?id=" + mediaNumber;
	}
	new_window = window.open(url, name, options);
	window.self.name = "main";
	new_window.focus();}


function startMediaOld(mediaNumber) 
{
var name = "MediaPlayer";
var options = "width=320,height=326,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no";
if(mediaNumber == null) { 	
var url = "/mediaplayer/index.php";
	}
else	{	
var url = "/mediaplayer/index.php?quickcode=" + mediaNumber;
	}		
new_window = window.open(url, name, options);
window.self.name = "main";	
new_window.focus();
}

function showImage(image) 
{
var name="imageWin";
var width=650;
var height=469;	
var url = "/showimage.php?image=" + image;
var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no";	
new_window = window.open(url, name, options);
window.self.name = "main";
new_window.focus();
}

function showPresentation(presentation, currentslide, maxslide) 
{
var name="imageWin";
var width=640;
var height=517;	
var url = "/showpresentation.php?presentation=" + presentation + "&currentslide=" + currentslide + "&maxslide=" + maxslide;
var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no";	new_window = window.open(url, name, options);	
window.self.name = "main";
new_window.focus();
}

function myClassEditor() 
{
var name="myClassEditor";
var width=640;
var height=517;	
var url = "http://intranet/myclass/index.php";
var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no";	new_window = window.open(url, name, options);	
window.self.name = "main";
new_window.focus();
}

function eNewsletter() 
{
var name="eNewsletter";
var width=720;
var height=400;	
var url = "http://intranet/mailing/index.php";
var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no";	new_window = window.open(url, name, options);	
window.self.name = "main";
new_window.focus();
}

function startAdvent() 
{
var name="CJSAdvent";
var width=700;
var height=520;	
var url = "http://www.cypressjuniors.co.uk/do/advent08/advent.htm";
var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no";	new_window = window.open(url, name, options);	
window.self.name = "main";
new_window.focus();
}


function startAdventCal(testMode) 
{
var name="CJSAdvent";
var width=700;
var height=520;	
if(testMode == "test") {
var url = "http://www.cypressjuniors.co.uk/do/advent/calendar.php?test=1";
	}
else	{
var url = "http://www.cypressjuniors.co.uk/do/advent/calendar.php";
	}
var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no";	new_window = window.open(url, name, options);	
window.self.name = "main";
new_window.focus();
}

function showAdventFull(number, page) 
{
var name="CJSAdventFull";
var url = "http://www.cypressjuniors.co.uk/do/advent/showfull.php?image=" + number;

if(page == "p") {
var width = "400";
var height = "610";
	}
else	{
var width = "600";
var height = "420";
	}

var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no";	new_window = window.open(url, name, options);	
window.self.name = "main";
new_window.focus();
}

function startMediaOld(mediaNumber) 
{
var name = "MediaPlayer";
var options = "width=600,height=330,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no";
if(mediaNumber == null) { 	
var url = "/mediaplayer/v2/index.php";
	}
else	{	
var url = "/mediaplayer/v2/index.php?quickcode=" + mediaNumber;
	}		
new_window = window.open(url, name, options);
window.self.name = "main";	
new_window.focus();
}


function startMediaOld2(mediaNumber, aspect) 
{

if(aspect == "16x9")
	{
		var winwidth=700;
	}
else
	{
		var winwidth=600;
		var aspect="4x3";
	}

var name = "MediaPlayer";
var options = "width=" + winwidth + ",height=330,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no";
if(mediaNumber == null) { 	
var url = "/mediaplayer/v2/index.php";
	}
else	{	
var url = "/mediaplayer/v2/index.php?quickcode=" + mediaNumber + "&aspect=" + aspect;
	}		
new_window = window.open(url, name, options);
window.self.name = "main";	
new_window.focus();
}

function playByte(ibyte) 
{

var name = "BytePlayer";
var options = "width=800,height=616,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no";
var url = "/learning/ibytes/ibyte.php?ibyte=" + ibyte;
new_window = window.open(url, name, options);
window.self.name = "main";	
new_window.focus();
}

function startMedia(mediaNumber, aspect) 
{
var name = "MediaPlayer";
var options = "width=600,height=520,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no";
var url = "/mediaplayer/v3/mediaplayer.php?quickcode=" + mediaNumber;		
new_window = window.open(url, name, options);
window.self.name = "main";	
new_window.focus();
}

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}


