﻿<!-- REVENUE SCIENCE AD TAG CODE -->
var rsi_segs = [];
var segs_beg=document.cookie.indexOf('rsi_segs=');
if(segs_beg>=0){
 segs_beg=document.cookie.indexOf('=',segs_beg)+1;
 if(segs_beg>0){
  var segs_end=document.cookie.indexOf(';',segs_beg);
  if(segs_end==-1)segs_end=document.cookie.length;
  rsi_segs=document.cookie.substring(segs_beg,segs_end).split('|');
}}
var segLen=20
var segQS="",segArr=new Array()
if (rsi_segs.length<segLen){segLen=rsi_segs.length}
for (var i=0;i<segLen;i++){
    segArr=rsi_segs[i].split("_")
    if (segArr.length>1) segQS+=("rsi"+"="+segArr[1]+"+")
}
<!-- END REVENUE SCIENCE AD TAG CODE -->

//Function call by flash to close the modal
function closeImageGallery(){
	$('#imageGallery').jqmHide();		
    $('#videoGallery').jqmHide();	
    //$("#showcaseBanner").show();
    //$("#skyscraperAdvert").show();    
}

  //Flash deploy variable
    AC_FL_RunContent = 0;



 function drawsheetLightBox(tid, modal)
    {       
        if (AC_FL_RunContent == 0) {
            alert("This page requires AC_RunActiveContent.js.");
        } else {
            AC_FL_RunContent_In_Container( modal, '',
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '1024px',
			'height', '768px',
			'src', '/swf/drawsheet/main.swf',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', '',
			'devicefont', 'false',
			'id', 'Drawsheet',
			'bgcolor', '#000000',
			'name', 'Drawsheet',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', '/swf/drawsheet/main',
			'flashVars','tid='+tid,
			'salign', ''             
                ); //end AC code
        }
    }
    
 function imageLightBox(categoryLink, modal, type, item_id)
    {
        var categoryId = -1;
        //Retrieve category id from URL
        if (item_id != null)
        {
            categoryId = item_id;
            //alert(categoryId);
        }
        else
        {
            var link = $(categoryLink).attr("href");
            var end = link.indexOf(".htm");
            var start = link.lastIndexOf('-')+1;
            categoryId = link.substring(start, end);
            //alert(categoryId);
            //alert(type);
        }
        
        if ( (parseInt(categoryId) > -1) || (type = 2) )
        {
                if (AC_FL_RunContent == 0) {
	                alert("This page requires AC_RunActiveContent.js.");
                } else {
	                AC_FL_RunContent_In_Container( modal, '',
		                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		                'width', '100%',
		                'height', '100%',
		                'src', 'swf/gallery/GalleryLoader.swf',
		                'quality', 'high',
		                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
		                'align', 'middle',
		                'play', 'true',
		                'loop', 'true',
		                'scale', 'showall',
		                'wmode', 'transparent',
		                'devicefont', 'false',
		                'id', 'Drawsheet',
		                'bgcolor', '#d2acd1',
		                'name', 'Drawsheet',
		                'menu', 'true',
		                'allowFullScreen', 'false',
		                'allowScriptAccess','sameDomain',
                        'flashVars', 'category_id='+categoryId+'&type='+type,
		                'movie', 'swf/gallery/GalleryLoader',
		                'salign', ''              
		                ); //end AC code
                }
             // $("#showcaseBanner").hide();                
              //$("#skyscraperAdvert").hide(); 
        }
        else
        {
            var container = document.getElementById("imageGallery"); 
            var link = $(categoryLink).html("href");
            container.innerHTML = "No gallery available";
            //Redirect user to the original link
            window.location = link;            
        }       
        //Stop link from clicking through
        return false;
    }


function gameLightBox(link, modal, game)
    {
        if (game != "")
        {
                if (AC_FL_RunContent == 0) {
	                alert("This page requires AC_RunActiveContent.js.");
                } else {
	                AC_FL_RunContent_In_Container( modal, '',
		                'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		                'width', '100%',
		                'height', '100%',
		                'src', 'wsa_games/'+game+'.swf',
		                'quality', 'high',
		                'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
		                'align', 'middle',
		                'play', 'true',
		                'loop', 'true',
		                'scale', 'showall',
		                'wmode', 'transparent',
		                'devicefont', 'false',
		                'id', 'Drawsheet',
		                'bgcolor', '#d2acd1',
		                'name', 'Drawsheet',
		                'menu', 'true',
		                'allowFullScreen', 'false',
		                'allowScriptAccess','sameDomain',
                        'flashVars', '',
		                'movie', 'wsa_games/'+game,
		                'salign', ''              
		                ); //end AC code
                }
              //$("#showcaseBanner").hide();                
              //$("#skyscraperBanner").hide(); 
        }
        else
        {
            var link = $(link).attr("href");
            //Redirect user to the original link
            window.location = link;            
        }       
        //Stop link from clicking through
        return false;
    }
    
	$(document).ready(function() {
		//$('#widgetNav').accordion({on: 4});
		$('#widgetNav').accordion({cookie:'wsa_cookie', on: 1});

        $('#imageGallery').jqm({
                overlay:0,
		        modal: false, 
		        trigger: 'a.galleryCategoryModal'
  		});
        $("a.galleryCategoryModal").click(function() {
            return imageLightBox(this, 'imageGallery', 1, null);
        });

        $('#videoGallery').jqm({
                overlay:0,
		        modal: false, 
		        trigger: 'a.videoModal'		        
  		});        
  		
  		$('#gamesContainer').jqm({
		        modal: false, 
		        trigger: 'a.gameModal'
		        ,
		        onHide: function(h){
		            h.w.slideUp("slow",function() { if(h.o) h.o.remove(); }); 
		           // $("#showcaseBanner").show();                
                    //$("#skyscraperBanner").show(); 
		        }    
  		});  
 
	});

   
   
