	function openWindow(url,name,height,width,left,top,bCenter,bMaxHeight,features)
		{
		if (!features)
			{
			features = ',toolbar=yes,scrollbars=yes,status=yes,location=yes';
			}
			else
			{
			features = ',' + features;
			}										
		if (bMaxHeight)
			{
			height = window.screen.availHeight-100;							
			}						
		if (bCenter && height && width)
			{
			top = ((window.screen.availHeight - height) / 2)-25;								
			left = (window.screen.availWidth  - width) / 2;	
			}										
		return window.open(url,name,'top=' + top +  ',left=' + left + ',height=' + height + ',width=' + width + features,'');
		}
	function showPlayer(streamID,bandwidth,prodid)
	{
		newWindow = openWindow("/player/?streamID=" + streamID + "&bandwidth=" + bandwidth,"madPlayer",500,610,"","",true);
		if (prodid!=null) window.location.href="/productions/fetch.aspx?prodid=" + prodid;
	}
	
	function play_video(id,type,size)
	{
	    var w;
	    var h;
	    switch (size)
	    {
	        case 320: w=360; h=280; break;
	        case 480: w=520; h=400; break;
	        case 640: w=680; h=480; break;
	        case 720: w=760; h=480; break;
	        default: w=856; h=480; break;
	    }
	    if(type==null) type="";
	    if(size==null) size="";
	    openWindow("/player/mp.aspx?id=" + id + "&t=" + type + "&s=" + size,"",h+200,w+50,"","",true);
	}
	function play_qt(url,w,h)
	{
	    openWindow("/player/qt.aspx?url=" + url + "&w=" + w + "&h=" + h,"",w+100,h+200,"","",true);
	}
	
	function ShowPhotoAlbum(albumpath,title)
	{
		window.open("/PhotoAlbum/?AlbumPath=" + albumpath + "&Title=" + title,"PhotoBrowser","height=600,width=800,toolbar=no,menubar=no,resizable=no,status=yes",true);
	}
	function showPhotoBrowser(Path,Title)
	{
		newWindow = openWindow("/PhotoBrowser/?Path=" + Path + "&Title=" + Title,"madPhotos",520,610,"","",true);		
	}
	
	function showPopUpPage(pageID)
	{
		openWindow("/getpage?id=" + pageID + "&ShowBanners=false","PopUpWindow",450,550,"","",true);
	}
	function printView()
	{
		window.location.href=document.location.href;
	}
	function webView()
	{
		window.location.href="";
	}
	function Search(type,q)
	{
	    if (type=="1")
	        window.open("http://www.google.com/custom?client=pub-8184969080351023&sitesearch=www.whatmadness.com&q=" + q);
	    else
	        window.open("http://www.google.com/custom?client=pub-8184969080351023&q=" + q);
	}
	
