﻿function SetUserId(_userid)
{
    NotifyEvent('P','Main','Home Page');
}

function NotifyEvent(eventType, eventDetail)
{
    var flashObject = document.getElementById('idgeneratorswf');
    if (flashObject && flashObject.NotifyEvent) flashObject.NotifyEvent(eventType,'Main','Home Page',eventDetail);    
}

function RestrictedPopup(theURL,showScrollbars) 
{ 		
    var winW = 1000;
    var winH = 680;
    var winX = (screen.availWidth - winW) / 2;
    var winY = (screen.availHeight - winH) / 2;

    var features = 'left='+winX+',top='+winY+',width='+winW+',height='+winH+',toolbar=0,location=0,status=0,resizable=0';		
    if (showScrollbars)
    {
        features += ',scrollbars=1';                
    }
    else
    {
        features += ',scrollbars=0';
    }

    window.open(theURL,'RestrictedChild',features);
}
		
$(document).ready(function()
{	
    var skipDetect = deconcept.util.getRequestParameter('skipflashdetect');
    if (skipDetect != "1")
    {
        var flashVersion = deconcept.SWFObjectUtil.getPlayerVersion();
        if (skipDetect == "0" || flashVersion.major < 8)
        {
            document.location.href = "getflash.html";
        }
    }
    
	$('.rollover-button').hover(
		function()
		{
			$(this).addClass("highlight");
		},
		function()
		{
			$(this).removeClass("highlight");
		}
	);
				
	$('#landing-page').click(function(){
		RestrictedPopup('landing.php',false);			
	});

	$('#member-registration').click(function(){
		RestrictedPopup('register_member.php',false);			
	});

	$('#parents').click(function(){
		RestrictedPopup('parents_section.html',false);			
	});
	
	$('#member-registration').mouseover(function(){PlaySound('planet_rollover_sound');});
	$('#landing-page').mouseover(function(){PlaySound('planet_rollover_sound2');});
	$('#parents').mouseover(function(){PlaySound('planet_rollover_sound3');});
	$('#retailer').mouseover(function(){PlaySound('planet_rollover_sound4');});
	
	$('#retailer').click(function(){	  		    				
	    NotifyEvent('L','retailers');
	    $('#blocker').show();
		$('#retailers-popup').fadeIn("fast");						
	});			
	
    $('#retailers-popup-close').click(function(){
	    $('#blocker').hide(0);
        $('#retailers-popup').fadeOut({duration:0.5});
    });
	
	$('#store-locator').click(function(){
	    NotifyEvent('L','store_locator');
		RestrictedPopup('store_locator.php',false);		
	});
	
	$('#about,#about2').click(function(){
	    NotifyEvent('L','about_us');
		RestrictedPopup('about_us.html',true);	
	});			

//	$('#about2').click(function(){
//		RestrictedPopup('about_us.html',false);	
//	});	
//	
	$('#terms').click(function(){
	    NotifyEvent('L','terms_and_conditions');
		RestrictedPopup('terms.php',true);			
	});			

	$('#tour').click(function(){
	    NotifyEvent('L','take_tour');
		RestrictedPopup('tour.php',false);		
	});			

	$('#star-log').click(function(){
	    NotifyEvent('L','star_log');
		window.open('http://shiningstarnews.typepad.com','_blank');		
	});		

	$('#privacy').click(function(){
	    NotifyEvent('L','privacy_policy');
		RestrictedPopup('privacy_policy.php',true);			
	});	

	$('#faqs').click(function(){
	    NotifyEvent('L','faq');
		RestrictedPopup('faqs.html',true);			
	});	

	$('#contact-us').click(function(){
	    NotifyEvent('L','contact_us');
		RestrictedPopup('contact_us.php',false);			
	});	

	$('#rb').click(function(){
	    NotifyEvent('L','russberrie');
		window.open('http://www.russberrie.com','_blank');		
	});	
	
	$('#age').click(function(){
	    NotifyEvent('L','age');
		window.open('http://www.ageinc.com','_blank');		
	});	

	$('#international').click(function(){
	    NotifyEvent('L','languages');
		window.location.href='languages.html';		
	});	

	$('#fan-club').click(function(){
	    NotifyEvent('L','fan-club');
		window.open('http://www.shiningstarsworld.com','_blank');		
	});	
					
	if (screen.width < 1024 || screen.height < 768)
	{
	    NotifyEvent('C','screen_resolution');	
		$('#screen-resolution-popup').fadeIn({duration:0.5});	
        $('#screen-resolution-popup-close').click(function(){
            $('#screen-resolution-popup').fadeOut({duration:0.5});
        });														
	}
			
});

function PlaySound(soundobj)
{
    var thissound = eval("document."+soundobj);
    if (thissound == null) return;
    
    try { thissound.Play(); }
    catch (e) { thissound.DoPlay(); }
}	