﻿jQuery(document).ready(function () {
    /*
	jQuery('div.ringtones div.item').each(function() {
	    var wrapperW = jQuery(this).parent().outerWidth();
	    var thumbW = jQuery(this).find('p.thumb').outerWidth(true);
	    var priceW = jQuery(this).find('p.price').outerWidth(true);
	    var getItNowW = jQuery(this).find('p.getItNow').outerWidth(true);

	    var h5W = wrapperW - (thumbW + priceW + getItNowW);
	    h5W = h5W - 10;
	    jQuery(this).find('h5').css({'margin-left':'0','margin-right':'0','padding-left':'0','padding-right':'0','width':h5W});
    });
    */
	
    jQuery('div#content a.videoLink').click(function() {
        jQuery('#content #videos div.list div.item').css('background','#ffffff');
        jQuery(this).parent().parent().css('background','#f2f2f2');
        
        var videoLink = "<object width='490' height='370'><param name='movie' value='videoURL'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='videoURL' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='490' height='370'></embed></object>";
        videoLink = videoLink.replace(/videoURL/g,jQuery(this).attr('href'));
    
        jQuery('div.video').html(videoLink);
        return false;
    });
    
    //selectPromo("MythicOlympicFlashModule");
});

function selectPromo(promotionName)
{
	if(promotionName == "MythicOlympicFlashModule")
	{
		jQuery('body').css('background-image', 'none');
		jQuery('#sub').css('display', 'none');
	}
	if(promotionName == "Valentines")
	{
		jQuery('body').removeAttr('style');
		jQuery('#sub').css('display', 'block');
	}
}

function ChangePromotion(promotionID)
{
	if(promotionID == 0)
	{
		jQuery('#guinessExclusiveContainer').show();
		ChangePlayList("http://www.youtube.com/cp/vjVQa1PpcFNmA1nAvg_NqhrqlWqHUinTjNBvqGsQBeA=");
		PageMethod("GetData", ["cat", "guinness"], OnRequestComplete, OnRequestError); //With parameters
		ChangeCallOuts("guinness");
		ChangeDownloads("promotion");
	}
	else
	{
		jQuery('#guinessExclusiveContainer').hide();
		ChangePlayList("http://www.youtube.com/cp/vjVQa1PpcFNmA1nAvg_NqmYLVtBEE_3edDjqhD-EnnE=");
		PageMethod("GetData", ["cat", "superhero"], OnRequestComplete, OnRequestError); //With parameters
		ChangeCallOuts("behold2");
		ChangeDownloads("promotion1");
	}
}

function ChangePlayList(videoPlayer)
{
	video = new SWFObject(videoPlayer, "samsung", "746", "413", "9", "#ffffff");
	video.addParam("wmode", "transparent");
	video.addParam("allowScriptAccess", "always");
	video.write("videos");
}

function ChangeVideo(videoID)
{
	  var ytplayer = document.getElementById("samsung");
	  ytplayer.cueVideoById(videoID);
	  ytplayer.playVideo();
}

function ChangeCallOuts(showWhich)
{
	jQuery('h3.behold2').hide();
	jQuery('h3.guinness').hide();
	jQuery('h3.' + showWhich).show();
}

function ChangeDownloads(showWhich)
{
	jQuery('#promotion').hide();
	jQuery('#promotion1').hide();
	jQuery('#' + showWhich).show();
}

