if(typeof GSS === 'undefined') {

var GSS = {};
}
if(typeof GSS.util === 'undefined') {

GSS.util = {};

}



/*
function debugConsole (str) {

console.log(str);

return

}


*/

GSS.util.viralLastDisplayState = 'hidden';


GSS.util.toggleDisplaySharePlugin = function () {

// this function is only called by content pane7 "Share" pane
// so we know we are at the end of the video as the video matrix is showing

var target = $f().getPlugin("viral"),
displayState = target["display"];


// we only need the share plugin to have a higher zindex then cp6d
// this should be the greatest zindex of all the cpD's

plugL2 = $f().getPlugin("cp6D");

zL2 = plugL2["zIndex"];

target.css('zIndex',zL2+100);





if(displayState === 'none' || displayState === undefined) {
 
 	 
 	 target.fadeIn();
 	 
 	 $f().showPlugin('viral');
 	 
 	 return this;
 	}
 
 else { // we are hiding the plugin as display is currently block

	target.fadeOut();
	return this;

	}




};


		
		
GSS.util.loadContentPanes = function () {

// cp6 =$f().getPlugin("cp6").css("display","block");
// cp6.setHtml($("#fp_cp6").html());
// alert("load content panes html hit");


var i,
			     			     paneId,panelId,
			     			     player = $f(),
			     			     target;
			     
			     			     for (i=1; i<10; i+=1) {
			     
			                                  paneId = "cp" + i;
			     			     target = player.getPlugin(paneId);
			                                  
			                                  	if(target) {
			                                  
			                                  	 target.setHtml($("#fp_"+paneId).html());
			     
			     
			     			     	}
			     			     
			     			     }
			     			     
			     	// we need to show all associated text panes  [ cp1D through cp9D ( looping cp7D cp8D (which will never exist ( share / playagain ) but matrix cp9D for the sponsor could well
			     	
			     	                     for (i=1; i<10; i+=1) {
			     	                     
			     	                     panelId="cp"+ i + "D";
			     	                     
			     	                     
			     	                     target = player.getPlugin(panelId); 
			     	                     
			     	                     	if (target) {
			     	                     
			     	                     	target.setHtml($("#fp_"+panelId).html());
			     	                        
			     			     
			     			     	}
			     			     
			     			}
			     			
			     	
			     	
			     // now we load all the cpDL - (DL implies Description Long )
			     // they are revealed - via the onMouseOver and onClick events of each cpD pane
			     
			     	for (i=1; i<10; i+=1) {
			     	                     
			     	                     panelId="cp"+ i + "DL";
			     	                     
			     	                     
			     	                     target = player.getPlugin(panelId); 
			     	                     
			     	                     	if (target) {
			     	                     
			     	                     	target.setHtml($("#fp_"+panelId).html());
			     	                        
			     			     
			     			     	}
			     			     
			     			}
		



};



GSS.util.hideContentPanes = function () {

// alert("hide content panes hit");

// this function is called if the Reduce Video Area button is clicked
// and the user reached the end of the video [ which is by default now displayed
// in large size revealing the content panes ]

                             
			     var i,
			     paneId,
			     player = $f(),
			     target;

			     for (i=1; i<10; i+=1) {

                             paneId = "cp" + i;
			     target = player.getPlugin(paneId);
                             
                             	if(target) {
                             
                             	 target.css("display","none");


			     	}
			     
			     }
			     
	// we need to hide all associated text panes  [ cp1D through cp9D ( looping cp7D cp8D (which will never exist ( share / playagain ) but matrix cp9D for the sponsor could well
	
	                     for (i=1; i<10; i+=1) {
	                     
	                     paneId="cp"+ i + "D";
	                     target = player.getPlugin(paneId); 
	                     
	                     	if (target) {
	                     
	                     	target.css("display","none");
	                    
			     
			     	}
			     
			     }
			     
			     };


GSS.util.showContentPanes = function () {

var plugL1,zL1,plugL2,zL2;

for( i=1; i< 10; i+=1 ){

plugL1 = $f().getPlugin("cp" +i);
zL1 = plugL1["zIndex"];
plugL2 = $f().getPlugin("cp" +i +"D");


if(plugL2) {

    zL2 = plugL2["zIndex"];

    if( zL2 < zL1 ) {

    plugL2.css('zIndex',zL1+1);

    }
}

plugL1.show();

if ( plugL2 ){

plugL2.show();

}

} // loop close


 };
			     
			     
			     
