// JavaScript Document

function showcasemenu ()

{
	//this retrieves the showcase folder name & opens the spry panel with the corresponding ID

	folder = document.URL.slice(document.URL.indexOf('/',26)+1,document.URL.indexOf('/',33));
	
	if(folder=='cii/showcase')
	{
	acc1.openPanel('showcase');
	}
	else
	{
	acc1.openPanel(folder);
	}
}
function resourcesmenu ()

{
	//this retrieves the showcase folder name & opens the spry panel with the corresponding ID

	folder = document.URL.slice(document.URL.indexOf('/',31)+1,document.URL.indexOf('/',42));
	
	if (folder.length >0)
	{
	acc1.openPanel(folder);
	}
	else
	{
		acc1.openPanel('resources');
	}
	
}

// folder = document.URL.slice(document.URL.indexOf('/',20)+1,document.URL.indexOf('/',23))

function goto (url)

{
	window.location.assign(url);
}

// JavaScript Document


function swap_layer(layer)
{switch (layer){
		case 'content':
		document.getElementById('contents_popup').style.display='none';
		document.getElementById('contents_popup_talkshow').style.display='block';
		break;
		case 'video':
		document.getElementById('contents_popup_talkshow').style.display='none';
		document.getElementById('contents_popup').style.display='block';
	}}
	
	
function openWindow1(location,ht,wid) 
  { 
  /*fade background effect*/
  Effect.Appear('fadescreen',{to:.75});
  /*user height & width*/
  var top_pos = f_scrollTop() + 20;
  var client_width = f_clientWidth();
  if(client_width<wid){var left_pos = 20;}else{var left_pos = (client_width/2)-(wid/2);}
  /*close an already-open panel */
  if(document.getElementById('popupwin')!=null){panel.destroy();}
  /*prototype UI window*/ 
  var url = location;
  panel = new UI.Window({show:Element.appear,hide:Element.fade,theme: "black_hud",id:'popupwin', shadow: false,height:ht,width:wid,minimize:false,maximize:false, top:top_pos,left:left_pos}).show()
  panel.setAjaxContent(url,{method: "GET"});
  panel.setZIndex(10000);
  panel.focus();
 
  panel.observe("destroyed",function(){Effect.Fade('fadescreen');});
  }    
  
  
  /*client size functions*/
  function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
