
function getWindowViewPortheight(){
 var viewportwidth;
 var viewportheight;
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }

if(viewportwidth/viewportheight>1){
	 var bannerDiv = document.getElementById('background');
	 var bannerHeight = new Number(viewportheight) - new Number(67);
	 bannerDiv.style.height = bannerHeight + 'px';
	 bannerDiv.style.position = 'relative';
	 bannerDiv.style.overflow = 'visible';

	  var backgroundPublisherDiv = document.getElementById('background-publisher');
	  var mainSlideNavDiv = document.getElementById('main-slide-nav');
	  if(backgroundPublisherDiv != null && backgroundPublisherDiv != '' && backgroundPublisherDiv!= undefined && mainSlideNavDiv != null && mainSlideNavDiv != '' && mainSlideNavDiv!= undefined){
		 mainSlideNavDiv.style.top = backgroundPublisherDiv.offsetTop - 100;
	  }
}
/*displaySliderPanelAtVerticallyCenter(viewportwidth);*/

}

var oMenu;
function showDropDown(){
	 YAHOO.util.Event.onContentReady("basicmenu", function () {
    var oMenu = new YAHOO.widget.Menu("basicmenu",{autosubmenudisplay: true

													});
	oMenu.render();
	YAHOO.util.Event.addListener("learnMore", "mouseover", oMenu.show, null, oMenu);
	YAHOO.util.Event.addListener("slider-learnMore", "mouseover", oMenu.show, null, oMenu);
    YAHOO.util.Event.addListener("basicmenu", "mouseover", oMenu.show, null, oMenu);
    });
}


function showMoreContent(id){
	document.getElementById("showContent_"+id).style.display="block";
	document.getElementById("showContent_"+id).style.visibility="visible";
	document.getElementById("hideContent_"+id).style.display="none";
	document.getElementById("hideContent_"+id).style.visibility="hidden";
}

function hideMoreContent(id){
	document.getElementById("hideContent_"+id).style.display="block";
	document.getElementById("hideContent_"+id).style.visibility="visible";
	document.getElementById("showContent_"+id).style.display="none";
	document.getElementById("showContent_"+id).style.visibility="hidden";
}

function showVideoPlayer(id){
		if(document.getElementById("video-display_"+id)){
			var videoObjList = document.getElementsByTagName("embed");
			for(var i=0; i<=videoObjList.length;i++){
				var videoObj =videoObjList[i];
				if(videoObj.id == "mp4_"+id){
					document.getElementById("mp4_"+id).style.display="block";
					document.getElementById("mp4_"+id).style.visibility="visible";
					
				}else{
					document.getElementById("mp4_"+id).style.display="none";
					document.getElementById("mp4_"+id).style.visibility="hidden";
					
				}
			}
			
		}
}




var timerCount;

jQuery(document).ready(function ()
{
	if($("#homePage").length>0){
		imageresize();
		alignSliderContentAtVerticallyCenter();
	
	}
	var currentSlide = 0;
	var maxSlides = jQuery("div.slide").length;
	if(document.getElementById("homePage")){
		clearTimeout(timerCount);
		timerCount = setTimeout(function () {fb_update_slider((currentSlide + 1) % maxSlides);}, 7000);
}
	function fb_isphoneagent()
	{
		try
		{
			return ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)));
		}
		catch (e) 
		{ 
			return false; 
		}
	}
	
	function fb_animate_to(elem, x)
	{
			/* All other browsers */
			jQuery(elem).animate({ left: x }, { duration: 550 });
		
	}
	
	function fb_fadein(elem)
	{
        jQuery(elem).fadeIn();
	}
	
	function fb_fadeout(elem)
	{
        jQuery(elem).fadeOut();
	}
	
	function fb_update_frame(reset)
	{
		var slides = jQuery("div.slide");
		var slide = slides[currentSlide];
		var slideFrames = jQuery(slide).find("img.slide-img");

        if (slideFrames.length < 2)
        {
            return;
        }

		var currentFrame = 0;
        if (reset)
        {
            jQuery(slide).data("currentFrame", currentFrame);
            jQuery(slideFrames).hide();
		 }
        else
        {
            currentFrame = jQuery(slide).data("currentFrame");
            currentFrame += 1;
            
            if (currentFrame >= slideFrames.length)
            {
                return;
            }

            jQuery(slide).data("currentFrame", currentFrame);
        }
        
        for (var i = 0; i < slideFrames.length; i++)
        {
			 if (i == currentFrame)
            {
				 fb_fadein(slideFrames[i]);
            }
            else if (i > currentFrame)
            {
                fb_fadeout(slideFrames[i]);
            }
        }
        
        setTimeout(function ()
        {
			fb_update_frame(false);
        }, 1500);
	}
	
	function fb_update_slider(index, force)
	{
		if (index == currentSlide && !force)
		{
			return;
		}

		var elem = jQuery("#slider-inner").get(0);
		var slideWidth =  jQuery(".slide").outerWidth();
		fb_animate_to(elem, index * -slideWidth);
		var captions = jQuery("div.slide-caption");
		jQuery(captions[currentSlide]).fadeOut();

		jQuery(captions[index]).delay(550).queue(function (next)
		{
			if (currentSlide === 0)
			{
				jQuery("#content-caption").removeClass("secondpage");
			}
			else
			{
				jQuery("#content-caption").addClass("secondpage");
			}
			next();
		}).fadeIn();

		jQuery("#main-slide-nav ul li a.selected").removeClass("selected");
		jQuery(jQuery("#main-slide-nav ul li a")[index]).addClass("selected");
		
		currentSlide = index;
		if(document.getElementById("homePage")){
		clearTimeout(timerCount);
		timerCount = setTimeout(function () {fb_update_slider((currentSlide + 1) % maxSlides);}, 14000);
		}
		//alert("mkPlaying" + mkPlaying);
		if(!mkPlaying){
			playVideo(currentSlide);
		} 
		fb_update_frame(true);
		alignSliderAtCenter();
	}
	
	jQuery("div.slide-caption").hide();
	jQuery(jQuery("div.slide-caption")[currentSlide]).show();

	function fb_center(src, inside)
	{
	    if (jQuery(src).width() == 0 || jQuery(src).height() == 0)
	    {
	       return;
	    }
        jQuery(src).css("position", "relative");
        jQuery(src).css("top", 0);
        jQuery(src).css("left", 0);
	}
	
	function fb_window_update()
	{
        //fb_center(jQuery("#slider-frame"), window);
	}
	
	if (!fb_isphoneagent())
	{
		/* Desktop version allows sliding around. */

    	jQuery(window).resize(fb_window_update);
    	fb_window_update();
    	
    	
    	jQuery(".slide-img").load(function ()
    	{
			 fb_center(jQuery(this), jQuery(this).parent());
    	});
    
    	jQuery(".slide-img").each(function ()
    	{
            fb_center(jQuery(this), jQuery(this).parent());
    	});
    
		jQuery("#nextslide").click(function ()
		{
			fb_update_slider((currentSlide + 1) % maxSlides);
			return false;
		});
		
		jQuery("#slider").click(function ()
		{
			//fb_update_slider((currentSlide + 1) % maxSlides);
			//return false;
		});
		
		jQuery('.slide').each(function (navIndex, elem)
		{
		    var dot = jQuery('<li><a href="#"><span>' + navIndex + '</span></a></li>');
            jQuery("#main-slide-nav ul").append(dot);
            dot.find("a").click(function (e)
            {
                fb_update_slider(navIndex);
                return false;
            });
		});
		
		jQuery("#main-slide-nav ul li a:first").addClass("selected");
	
	
	}
	else
	{
		/* Mobile version links directly to YouTube. */
		
	}
	
	
});





/***** Start jquery functions for Learn More link ********/

function jsddm_open()
{	jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $(this).find('ul').eq(0).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;}}

/***** End jquery functions for Learn More link ********/




//0 means disabled; 1 means enabled;
var popupStatus = 0;
//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled

	
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#learn-more-popup").fadeIn("slow");
		popupStatus = 1;
	}
}
//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#learn-more-popup").fadeOut("slow");
		popupStatus = 0;
	}
}
//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = "";
	var windowHeight = "";
	var popupHeight = $("#learn-more-popup").height();
	var popupWidth = $("#learn-more-popup").width();

	if (typeof window.innerWidth != 'undefined')
	{
      windowWidth = window.innerWidth,
      windowHeight = window.innerHeight
	}
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       windowWidth = document.documentElement.clientWidth,
       windowHeight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       windowWidth = document.getElementsByTagName('body')[0].clientWidth,
       windowHeight = document.getElementsByTagName('body')[0].clientHeight
 }

	//centering
	$("#learn-more-popup").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
}


//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
	
	//LOADING POPUP
	//Click the button event!
	//$("#button").click(function(){
		//centering with css
		centerPopup();
		//load popup
		loadPopup();
	//});		
	//CLOSING POPUP
	//Click the x event!
	$("#popupContactClose").click(function(){
		disablePopup();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});
});



var swObject = ''
function displayVideo(index,page,course){
	  swObject  = 'swObject' + index;
	  var autoStartValue = false;
	  if(index == 1){
		autoStartValue = true;
	  }
	  var fileName = getFile(index,page,course);
	  var previewImage = getPreviewImage(index,page,course);
	 // alert("fileName - " + fileName);
		//	alert("previewImage - " + previewImage);
	  var videoSliderWidth = '502';
	  if(page=="satSolution" || page == "psatSolution" || page == "actSolution"){
		videoSliderWidth = '500';
	  }
	  swObject= new SWFObject('http://www.snapwiz.com/prep/mediaplayer/player.swf', 'playerId'+index, videoSliderWidth, '304', '9.0.124');
	  swObject.addParam('allowscriptaccess',   'always');
	  swObject.addParam('allowfullscreen',     'true');
	  // swObject.addParam("wmode", "opaque");
	  swObject.addParam('allowscriptaccess','always');
	  swObject.addVariable('enablejs','true');
	  swObject.addParam('flashvars','streamer=rtmpe://www.snapwiz.com:1936/swplayermodule/vod/&file='+fileName+'&skin=http://www.snapwiz.com/prep/mediaplayer/polishedmetal.zip'+'&image='+previewImage+'&stretching=exactfit');
	  swObject.write('mediaspace'+index);
	 }

	
      
 function getFile(index,page,course){
	 var fileName = '';
	 var previewImage

if(page =="satLesson"){
	 if(index == 1){
		 // fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9sdmlkZW8vTC0zODAtMS8vMjkvMDYvMjAxMTo6Nzo1NQ=='
		 if(course == "gre"){
			 fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9sdmlkZW8vTC0xNTgyLTEvLzAzLzEwLzIwMTE6OjE3OjU2'  // /swvideo/gre/lvideo/L-1582-1 //kevin
		  }else{
			 fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dtYXQvbHZpZGVvL0wtMjU3My0xLy8wNS8wMS8yMDEyOjoxNDoyNQ==' // /swvideo/gmat/lvideo/L-2573-1 // Sentence Correction Methodology        
		  }
			//  previewImage = 'http://barronsqa.snapwiz.net/images/barrons-preview-l-k-1.png'
	 }
	 else if(index == 2){
		// fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9sdmlkZW8vTC0xMDAtMS8vMjkvMDYvMjAxMTo6Nzo1NQ=='
		if(course == "gre"){
		  fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9sdmlkZW8vTC0xNjM5LTEvLzAzLzEwLzIwMTE6OjE3OjU0'  // /swvideo/gre/lvideo/L-1639-1 // orinain
		 // previewImage = 'http://barronsqa.snapwiz.net/images/barrons-preview-l-o-2.png'
		
		 }else{
			 fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dtYXQvbHZpZGVvL0wtMjQyMi0xLy8wNS8wMS8yMDEyOjoxNDoyNg==' //  /swvideo/gmat/lvideo/L-2422-1       // General Geometry Strategies     
		 }
	 }
	  else if(index == 3){
		 if(course == "gre"){
		// fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9sdmlkZW8vTC03NjctMS8vMjkvMDYvMjAxMTo6Nzo1NQ=='
		   fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9sdmlkZW8vTC0xNjUwLTEvLzAzLzEwLzIwMTE6OjE3OjU3'  // /swvideo/gre/lvideo/L-1650-1 // Ender
		 //  previewImage = 'http://barronsqa.snapwiz.net/images/barrons-preview-l-e-3.png'
		}else{
			 fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dtYXQvbHZpZGVvL0wtMjU2Mi0xLy8yMy8xMi8yMDExOjoxNToz'  // 
		 }
	 }
}
else if(page == "satSolution"){
	 if(index == 1){

		//alert("course" + course);

		  if(course == "gre"){
		 // fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9xLWV4cGxhbmF0aW9uLXZpZGVvLzQyMDcvRS04OTEzNS0xLy8yOS8wNi8yMDExOjo3OjU1'
			fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9xdmlkZW8vRS0xMjQ5MjItMS8vMDMvMTAvMjAxMTo6MTc6NTk='  // /swvideo/gre/qvideo/E-124922-1 // shara
			// previewImage = 'http://barronsqa.snapwiz.net/images/barrons-preview-e-s-1.png'
			}else{
			 fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dtYXQvcXZpZGVvL0UtMTMzMjI5LTEvLzA1LzAxLzIwMTI6OjE3OjE3'  // /swvideo/gmat/qvideo/E-133229-1 // shara
		 }
	 }
	 else if(index == 2){

		 if(course == "gre"){
		// fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9xLWV4cGxhbmF0aW9uLXZpZGVvLzQ1NDAvRS05MDk2MS0xLy8yOS8wNi8yMDExOjo3OjU1'
		   fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9xdmlkZW8vRS0xMjQ4NDUtMS8vMDMvMTAvMjAxMTo6MTc6NTg=' // /swvideo/gre/qvideo/E-124845-1 // kevin
		  //  previewImage = 'http://barronsqa.snapwiz.net/images/barrons-preview-e-k-2.png'
		  }else{
			 fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dtYXQvcXZpZGVvL0UtMTMzMjkwLTEvLzA1LzAxLzIwMTI6OjE3OjE4'  // /swvideo/gmat/qvideo/E-133290-1 // shara
		 }
	 }
	  else if(index == 3){

		  if(course == "gre"){
		// fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9xLWV4cGxhbmF0aW9uLXZpZGVvLzQ1NDIvRS05MjAxMS0xLy8yOS8wNi8yMDExOjo3OjU1'
		   fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9xdmlkZW8vRS0xMjQ5OTQtMS8vMDMvMTAvMjAxMTo6MTc6NTc='  // /swvideo/gre/qvideo/E-124994-1 // orian
		   // previewImage = 'http://barronsqa.snapwiz.net/images/barrons-preview-e-o-3.png'
		   }else{
			 fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dtYXQvcXZpZGVvL0UtMTMzMTExLTEvLzA1LzAxLzIwMTI6OjE3OjE5'  // /swvideo/gmat/qvideo/E-133111-1 // shara
		 }
		   
	 }
	  

}

//alert("fileName - " + fileName);
	return fileName;


	
  }

  function getPreviewImage(index,page,course){
	 var fileName = '';
	 var previewImage
		 mkPlaying = false;

if(page =="satLesson"){
	 if(index == 1){

		  if(course == "gre"){
		    // fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9sdmlkZW8vTC0zODAtMS8vMjkvMDYvMjAxMTo6Nzo1NQ=='
			//fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9sdmlkZW8vTC0xNTgyLTEvLzAzLzEwLzIwMTE6OjE3OjU2'  // /swvideo/gre/lvideo/L-1582-1 //kevin
			  previewImage = 'http://barronstestprep.com/images/barrons-preview-l-k-1.png'
			  }else{
			 previewImage = 'http://barronstestprep.com/images/barrons-preview-1-gmat-1-2.png'
		 }
	 }
	 else if(index == 2){

		  if(course == "gre"){
		 // fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9sdmlkZW8vTC0xMDAtMS8vMjkvMDYvMjAxMTo6Nzo1NQ=='
		 // fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9sdmlkZW8vTC0xNjM5LTEvLzAzLzEwLzIwMTE6OjE3OjU0'  // /swvideo/gre/lvideo/L-1639-1 // orinain
		  previewImage = 'http://barronstestprep.com/images/barrons-preview-l-o-2.png'
		  }else{
			 previewImage = 'http://barronstestprep.com/images/barrons-preview-1-gmat-1-1.png'
		 }
	 }
	  else if(index == 3){

		  if(course == "gre"){
		  // fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9sdmlkZW8vTC03NjctMS8vMjkvMDYvMjAxMTo6Nzo1NQ=='
		  // fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9sdmlkZW8vTC0xNjUwLTEvLzAzLzEwLzIwMTE6OjE3OjU3'  // /swvideo/gre/lvideo/L-1650-1 // Ender
		   previewImage = 'http://barronstestprep.com/images/barrons-preview-l-e-3.png'
		   }else{
			 previewImage = 'http://barronstestprep.com/images/barrons-preview-1-gmat-1-3.png'
		 }
	 }
}
else if(page == "satSolution"){
	 if(index == 1){

		 if(course == "gre"){
		    // fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9xLWV4cGxhbmF0aW9uLXZpZGVvLzQyMDcvRS04OTEzNS0xLy8yOS8wNi8yMDExOjo3OjU1'
			//fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9xdmlkZW8vRS0xMjQ5MjItMS8vMDMvMTAvMjAxMTo6MTc6NTk='  // /swvideo/gre/qvideo/E-124922-1 // shara
			 previewImage = 'http://barronstestprep.com/images/barrons-preview-e-s-1.png'
			 }else{
			 previewImage = 'http://barronstestprep.com/images/barrons-preview-1-gmat-1-3.png'
		 }
	 }
	 else if(index == 2){

		 if(course == "gre"){
		  // fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9xLWV4cGxhbmF0aW9uLXZpZGVvLzQ1NDAvRS05MDk2MS0xLy8yOS8wNi8yMDExOjo3OjU1'
		  // fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9xdmlkZW8vRS0xMjQ4NDUtMS8vMDMvMTAvMjAxMTo6MTc6NTg=' // /swvideo/gre/qvideo/E-124845-1 // kevin
		    previewImage = 'http://barronstestprep.com/images/barrons-preview-e-k-2.png'
			}else{
			 previewImage = 'http://barronstestprep.com/images/barrons-preview-1-gmat-1-2.png'
		 }
	 }
	  else if(index == 3){

		   if(course == "gre"){
		   // fileName = 'RkFMU0UvLy9zd3ZpZGVvL3NhdC9xLWV4cGxhbmF0aW9uLXZpZGVvLzQ1NDIvRS05MjAxMS0xLy8yOS8wNi8yMDExOjo3OjU1'
		   //  fileName = 'RkFMU0UvLy9zd3ZpZGVvL2dyZS9xdmlkZW8vRS0xMjQ5OTQtMS8vMDMvMTAvMjAxMTo6MTc6NTc='  // /swvideo/gre/qvideo/E-124994-1 // orian
		    previewImage = 'http://barronstestprep.com/images/barrons-preview-e-o-3.png'
			}else{
			 previewImage = 'http://barronstestprep.com/images/barrons-preview-1-gmat-1-3.png'
		 }
		   
	 }
	  

}

//alert("previewImage - " + previewImage);
	return previewImage;


	
  }


function loadSliderVideos(videoFilesCount,page,course){
	for (var i=1;i<videoFilesCount+1;i++) {
		displayVideo(i,page,course);
	}
}


function playVideo(index){
	mkPlaying = false;
	var playerObj = "";
	var nextPlayerId = "";
	var nextPlayerObj = ""
	var videoObjList = "";
	if (navigator.appName.indexOf('Microsoft') != -1)
				var	browser = 'IE'
					if (browser == 'IE') {
						videoObjList = document.getElementsByTagName("object");
					}
					else {
						videoObjList = document.getElementsByTagName("embed");
					}

 	for(var i=0; i< videoObjList.length;i++){
	var videoObj = videoObjList[i];
		if(videoObj!= undefined && videoObj!= null && videoObj!=''){
			playerObj = window.document[videoObj.id];
			if(playerObj!= undefined && playerObj!= null && playerObj!=''){
				playerObj.sendEvent("STOP");
		}
		}
	}

	nextPlayerId  = 'playerId' + (index + 1);
	nextPlayerObj = window.document[nextPlayerId];
	if(nextPlayerObj!= undefined && nextPlayerObj!= null && nextPlayerObj!=''){
		nextPlayerObj.sendEvent("STOP");
	}
}

/*function displaySliderPanelAtVerticallyCenter(viewportwidth){
	$("#nextslide").css("left",viewportwidth/2-120);
	if(viewportwidth <= 1024){
	$("#nextslide").css("left", "0px");
	$("#nextslide").css("position", "relative");
	$("#nextslide").css("float", "right");
	$("#nextslide").css("clear", "both");
	}
}*/

$("#slider").ready(function() {
	alignSliderAtCenter();
});

function alignSliderAtCenter(){
	$("#showcase1").css("margin-left", ((($(window).width() - $("#showcase1").outerWidth()) / 2) + $(window).scrollLeft())+ "px");
	$(".contentDiv").css("position", "absolute");
	$(".contentDiv").css("margin-left", ((($(window).width() - $("#contentDiv").outerWidth()) / 2) + $(window).scrollLeft() + 250 ) + "px");
	/*$(window).resize(function() {
		$("#showcase-2").css("margin-left", (($(window).width() - $("#showcase-2").outerWidth()) / 2) + $(window).scrollLeft() + "px");
		//$("#contentDiv").css("position", "absolute");
		//$("#contentDiv").css("margin-left", ((($(window).width() - $("#contentDiv").outerWidth()) / 2) + $(window).scrollLeft() + 250 ) + "px");

	});*/

}

function alignSliderContentAtVerticallyCenter(){
	var contentheight = $(window).height();
	var sliderheight = $("#slider-frame").height();
	var bodyHt = $(".body-content").height();
	
    var sliderTopAndBottomHt = contentheight - ($(".body-content").height() + $("#slider-frame").height() + $(".publishers").height());
	var marginTopValue = 0;
	if((sliderTopAndBottomHt/2) > 0){
		marginTopValue = (sliderTopAndBottomHt/2);
	}
	 $("#slider-frame").css('margin-top',marginTopValue);
    $("#contentDiv").css('margin-top',marginTopValue);
}


function imageresize() {
	 var contentheight = $(window).height();
	 var imageHeight = '';
	 var iwidth = ''
     var ah = getMidSectionHeight();
	 if(ah <= 420){
		$('#slideImage1').attr('src','images/home_carousel02-3.jpg');
		$('#slideImage2').attr('src','images/home_carousel03-3.jpg');
		$('#slideImage3').attr('src','images/home_carousel04-3.jpg');
		$('#slideImage4').attr('src','images/home_carousel05-3.jpg');
		 imageHeight = 420;
	}
	 else if(ah > 420 && ah<= 550){
		 $('#slideImage1').attr('src','images/home_carousel02-2.jpg');
		 $('#slideImage2').attr('src','images/home_carousel03-2.jpg');
		 $('#slideImage3').attr('src','images/home_carousel04-2.jpg');
		 $('#slideImage4').attr('src','images/home_carousel05-2.jpg');
	     imageHeight = 550;
	 }
	 else if(ah > 550) {
		 $('#slideImage1').attr('src','images/home_carousel02.jpg');
		 $('#slideImage2').attr('src','images/home_carousel03.jpg');
		$('#slideImage3').attr('src','images/home_carousel04.jpg');
		$('#slideImage4').attr('src','images/home_carousel05.jpg');
	    imageHeight = 630;
	 }

	 if(imageHeight > ah){
		$('.slide').css('height',ah);
		 var imgWidth = (1000 * ah)/imageHeight;
		 $('.slide').css('width',imgWidth);
		 //alert("image : " + ('img.slide-img').imgscale);
		 //alert(imageHeight);
		 //alert(ah);
		 if (('img.slide-img').imgscale == undefined)
		 { 
			//alert("undefined");

		 } else {
			 $('img.slide-img').imgscale({
				parent : '.slide',
				center : true,
				scale:'fit'
			  });
		 }
	}
	else {
		$('.slide').css('height',imageHeight);
		$('.slide').css('width','1000');
		alignSliderContentAtVerticallyCenter(imageHeight);
	}
 }

 function getMidSectionHeight(){
	var headerDivSection = document.getElementById("header-container"); 
	var footerDivSection = document.getElementById("publishers");
	var contentheight = $(window).height();
	var headerSectionHt = '';
	var footerDivSectionHt = '';
	var cyclewrapDivSectionHt = '';
	if(headerDivSection != undefined && headerDivSection!= null && headerDivSection!= ''){
		headerSectionHt = headerDivSection.clientHeight;
	}
	if(footerDivSection != undefined && footerDivSection!= null && footerDivSection!= ''){
		footerDivSectionHt = footerDivSection.clientHeight;
	}
		
	var midSectionht = contentheight - (headerSectionHt + footerDivSectionHt);
	return midSectionht;
}
