﻿var currentPageSubnav;

 function trackClick(tracking_var,type){
	 MATTEL.tracker.Tracker.enableShortCuts();
	Tracker.name = tracking_var;
	Tracker.campaign = CAMPAIGN.NONE;
	Tracker.channel = CHANNEL.FRIENDS;
	if (type == '' || type == null){
		Tracker.contenttype = CONTENTTYPE.BUTTON;
		Tracker.action = ACTION.CLICK;
		//alert('button');
	}
	if (type == 'download'){
		Tracker.contenttype = CONTENTTYPE.DOWNLOAD;
		Tracker.action = ACTION.CLICK;
		//alert('download');
	}
	if(type == 'findonline')
	{
		Tracker.action = ACTION.SEETOYS;
		Tracker.contenttype = CONTENTTYPE.BUTTON;
	}
	//Tracker.action = ACTION.CLICK;
	Tracker.track();
 }



$(function () {

$('#circle').attr('style','background: url("_img/featured/circle1.png") no-repeat scroll 0 0 transparent; height: 650px; margin: 0 auto; left:515px; position: absolute;');

$("ul#topnav li").hover( function () {
            if (currentPageSubnav && $(this).find("ul").length > 0)
                currentPageSubnav.slideUp("fast");
            $(this).find("ul").slideDown("fast"); } ,
        function () {
            $(this).find("ul").slideUp("fast");
            if (currentPageSubnav && $(this).find("ul").length > 0)
                currentPageSubnav.slideDown("fast"); } );
		
 
$(".langs").hover( function () {
                 $(".langs").find("ul").slideDown("fast"); 
	    } ,
        function () {
            	$(".langs").find("ul").slideUp("fast");
            } );		


//******** photo gallery *****************************************************************
var totalimages=12;
var currentimage = Math.floor( (Math.random() * totalimages)+1);
	
$('#gallery').append("<img src=\"_img/product_gallery/gallery"+currentimage+".png\" />");

$('#gallery .prev').click( function() { 

	if (currentimage != 1)
	currentimage = currentimage - 1;
	else
	currentimage = 12;
		
	$('#gallery > img').attr("src","_img/product_gallery/gallery" + currentimage + ".png");
	
});

/*
.hover(function(){ 
		$(this).html('<img src="_img/product_gallery/prev.png" alt="prev" />'); 
		}, 
	function() { 
		$(this).html('<img src="_img/product_gallery/prev_dis.png" alt="prev" />'); 	
	} );
*/
	
$('#gallery .next').click( function() { 
	
	if (currentimage != 12)
	currentimage = currentimage + 1;
	else
	currentimage = 1;
		
	$('#gallery > img').attr("src","_img/product_gallery/gallery" + currentimage + ".png");
	
});




//******** brand photo gallery *****************************************************************
var totalimages=12;
var currentimage = Math.floor( (Math.random() * totalimages)+1);
	
$('#brandgallery').append("<img src=\"_img/brand_gallery/gallery"+currentimage+".png\" />");

$('#brandgallery .prev').click( function() { 

	if (currentimage != 1)
	currentimage = currentimage - 1;
	else
	currentimage = 12;
		
	$('#brandgallery > img').attr("src","_img/brand_gallery/gallery" + currentimage + ".png");
	
});
	
$('#brandgallery .next').click( function() { 
	
	if (currentimage != 12)
	currentimage = currentimage + 1;
	else
	currentimage = 1;
		
	$('#brandgallery > img').attr("src","_img/brand_gallery/gallery" + currentimage + ".png");
	
});



}); //end onready
