
valPos_a = 0; valPos_l = 0; valPos_t = 0; valPos_w = 0; valPos_b = 0;
val_a = "0px"; val_l = "0px"; val_t = "0px"; val_w = "0px"; val_b = "0px";
firstClick_a = true; firstClick_l = true; firstClick_t = true; firstClick_w = true; firstClick_b = true;
totalBox_a=0;totalBox_l=0;totalBox_t=0;totalBox_w=0;totalBox_b=0;
boxWidth_a=0;boxWidth_l=0;boxWidth_t=0;boxWidth_w=0;boxWidth_b=0;
minslideNext_a = 0;minslideNext_l = 0;minslideNext_t = 0;minslideNext_w = 0;minslideNext_b = 0;
nextPos_a = 0;nextPos_l = 0;nextPos_t = 0;nextPos_w = 0;nextPos_b = 0;
prevPos_a = 0;prevPos_l = 0;prevPos_t = 0;prevPos_w = 0;prevPos_b = 0;
prevPosFisrt_a = 0;prevPosFisrt_l = 0;prevPosFisrt_t = 0;prevPosFisrt_w = 0;prevPosFisrt_b = 0;

com.winamp.domain = "http://" + document.domain;
if(window.location.port > 80) {
	com.winamp.domain += ":" + window.location.port;
}
com.winamp.updateDistributionUrl = com.winamp.domain + "/modules/updateDistribution.jsp";

function initBadgeAnimation(size) {
	totalBox_b=parseInt(size);
	boxWidth_b=198;
	minslideNext_b = -(boxWidth_b*totalBox_b);
	nextPos_b = -(boxWidth_b*3);
	prevPos_b = -(boxWidth_b*(1+totalBox_b));
	prevPosFisrt_b = -(boxWidth_b*(2+totalBox_b));
}

function slideNextBadge(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_b) {
		valPos_b = nextPos_b;
		firstClick_b = false;
	} else {
		valPos_b = valPos_b - boxWidth_b;
	}
	if(valPos_b<minslideNext_b) {
		valPos_b=0;
		val_b = parseInt(valPos_b) +"px";
		sliderObj.animate({ "left" : val_b }, 0);
		valPos_b = valPos_b - boxWidth_b;
	} 
	val_b = parseInt(valPos_b) +"px";
	sliderObj.animate({ "left" : val_b }, 800);
}
function slidePrevBadge(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_b) {
		valPos_b = prevPosFisrt_b;
		firstClick_b = false;
		val_b = parseInt(valPos_b) +"px";
		sliderObj.animate({ "left" : val_b }, 0);
		valPos_b = valPos_b + boxWidth_b;
	} else {
		valPos_b = valPos_b + boxWidth_b;
	}
	if(valPos_b>-boxWidth_b) {	
		valPos_b = prevPos_b;
		firstClick_b = false;
		val_b = parseInt(valPos_b) +"px";
		sliderObj.animate({ "left" : val_b }, 0);
		valPos_b = valPos_b + boxWidth_b;
	}
	val_b = valPos_b +"px";
	sliderObj.animate({ "left" : val_b }, 800);
}

function initWalPaperAnimation(size) {
	totalBox_w=parseInt(size);
	boxWidth_w=198;
	minslideNext_w = -(boxWidth_w*totalBox_w);
	nextPos_w = -(boxWidth_w*3);
	prevPos_w = -(boxWidth_w*(1+totalBox_w));
	prevPosFisrt_w = -(boxWidth_w*(2+totalBox_w));
}

function slideNextWalPaper(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_w) {
		valPos_w = nextPos_w;
		firstClick_w = false;
	} else {
		valPos_w = valPos_w - boxWidth_w;
	}
	if(valPos_w<minslideNext_w) {
		valPos_w=0;
		val_w = parseInt(valPos_w) +"px";
		sliderObj.animate({ "left" : val_w }, 0);
		valPos_w = valPos_w - boxWidth_w;
	} 
	val_w = parseInt(valPos_w) +"px";
	sliderObj.animate({ "left" : val_w }, 800);
}
function slidePrevWalPaper(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_w) {
		valPos_w = prevPosFisrt_w;
		firstClick_w = false;
		val_w = parseInt(valPos_w) +"px";
		sliderObj.animate({ "left" : val_w }, 0);
		valPos_w = valPos_w + boxWidth_w;
	} else {
		valPos_w = valPos_w + boxWidth_w;
	}
	if(valPos_w>-boxWidth_w) {	
		valPos_w = prevPos_w;
		firstClick_w = false;
		val_w = parseInt(valPos_w) +"px";
		sliderObj.animate({ "left" : val_w }, 0);
		valPos_w = valPos_w + boxWidth_w;
	}
	val_w = valPos_w +"px";
	sliderObj.animate({ "left" : val_w }, 800);
}

function initTshirtAnimation(size) {
	totalBox_t=parseInt(size);
	boxWidth_t=198;
	minslideNext_t = -(boxWidth_t*totalBox_t);
	nextPos_t = -(boxWidth_t*3);
	prevPos_t = -(boxWidth_t*(1+totalBox_t));
	prevPosFisrt_t = -(boxWidth_t*(2+totalBox_t));
}

function slideNextTshirt(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_t) {
		valPos_t = nextPos_t;
		firstClick_t = false;
	} else {
		valPos_t = valPos_t - boxWidth_t;
	}
	if(valPos_t<minslideNext_t) {
		valPos_t=0;
		val_t = parseInt(valPos_t) +"px";
		sliderObj.animate({ "left" : val_t }, 0);
		valPos_t = valPos_t - boxWidth_t;
	} 
	val_t = parseInt(valPos_t) +"px";
	sliderObj.animate({ "left" : val_t }, 800);
}
function slidePrevTshirt(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_t) {
		valPos_t = prevPosFisrt_t;
		firstClick_t = false;
		val_t = parseInt(valPos_t) +"px";
		sliderObj.animate({ "left" : val_t }, 0);
		valPos_t = valPos_t + boxWidth_t;
	} else {
		valPos_t = valPos_t + boxWidth_t;
	}
	if(valPos_t>-boxWidth_t) {	
		valPos_t = prevPos_t;
		firstClick_t = false;
		val_t = parseInt(valPos_t) +"px";
		sliderObj.animate({ "left" : val_t }, 0);
		valPos_t = valPos_t + boxWidth_t;
	}
	val_t = valPos_t +"px";
	sliderObj.animate({ "left" : val_t }, 800);
}

function initLogoAnimation(size) {
	totalBox_l=parseInt(size);
	boxWidth_l=198;
	minslideNext_l = -(boxWidth_l*totalBox_l);
	nextPos_l = -(boxWidth_l*3);
	prevPos_l = -(boxWidth_l*(1+totalBox_l));
	prevPosFisrt_l = -(boxWidth_l*(2+totalBox_l));
}

function slideNextLogo(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_l) {
		valPos_l = nextPos_l;
		firstClick_l = false;
	} else {
		valPos_l = valPos_l - boxWidth_l;
	}
	if(valPos_l<minslideNext_l) {
		valPos_l=0;
		val_l = parseInt(valPos_l) +"px";
		sliderObj.animate({ "left" : val_l }, 0);
		valPos_l = valPos_l - boxWidth_l;
	} 
	val_l = parseInt(valPos_l) +"px";
	sliderObj.animate({ "left" : val_l }, 800);
}
function slidePrevLogo(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_l) {
		valPos_l = prevPosFisrt_l;
		firstClick_l = false;
		val_l = parseInt(valPos_l) +"px";
		sliderObj.animate({ "left" : val_l }, 0);
		valPos_l = valPos_l + boxWidth_l;
	} else {
		valPos_l = valPos_l + boxWidth_l;
	}
	if(valPos_l>-boxWidth_l) {	
		valPos_l = prevPos_l;
		firstClick_l = false;
		val_l = parseInt(valPos_l) +"px";
		sliderObj.animate({ "left" : val_l }, 0);
		valPos_l = valPos_l + boxWidth_l;
	}
	val_l = valPos_l +"px";
	sliderObj.animate({ "left" : val_l }, 800);
}

function initStickerAnimation(size) {
	totalBox_a=parseInt(size);
	boxWidth_a=198;
	minslideNext_a = -(boxWidth_a*totalBox_a);
	nextPos_a = -(boxWidth_a*3);
	prevPos_a = -(boxWidth_a*(1+totalBox_a));
	prevPosFisrt_a = -(boxWidth_a*(2+totalBox_a));
}

function slideNextSticker(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_a) {
		valPos_a = nextPos_a;
		firstClick_a = false;
	} else {
		valPos_a = valPos_a - boxWidth_a;
	}
	if(valPos_a<minslideNext_a) {
		valPos_a=0;
		val_a = parseInt(valPos_a) +"px";
		sliderObj.animate({ "left" : val_a }, 0);
		valPos_a = valPos_a - boxWidth_a;
	} 
	val_a = parseInt(valPos_a) +"px";
	sliderObj.animate({ "left" : val_a }, 800);
}
function slidePrevSticker(slider){
	var sliderObj = $("div#"+slider);
	if(firstClick_a) {
		valPos_a = prevPosFisrt_a;
		firstClick_a = false;
		val_a = parseInt(valPos_a) +"px";
		sliderObj.animate({ "left" : val_a }, 0);
		valPos_a = valPos_a + boxWidth_a;
	} else {
		valPos_a = valPos_a + boxWidth_a;
	}
	if(valPos_a>-boxWidth_a) {	
		valPos_a = prevPos_a;
		firstClick_a = false;
		val_a = parseInt(valPos_a) +"px";
		sliderObj.animate({ "left" : val_a }, 0);
		valPos_a = valPos_a + boxWidth_a;
	}
	val_a = valPos_a +"px";
	sliderObj.animate({ "left" : val_a }, 800);
}

com.winamp.Promote = function(){
	com.winamp.choseId = '';
	var temp = $('#promoteCont .mainSlide .prev');
	temp.mouseover(com.winamp.PromoteEvents.hoverPrev);
    temp.mouseout(com.winamp.PromoteEvents.outPrev);
	
	temp = $('#promoteCont .mainSlide .next');
	temp.mouseover(com.winamp.PromoteEvents.hoverNext);
    temp.mouseout(com.winamp.PromoteEvents.outNext);
	
	$('#promoteCont .mainSlide .choose').click(com.winamp.PromoteEvents.showPop);
	$('#streamAudio .audiostrm').mouseover(com.winamp.PromoteEvents.hoverThis);
	$('#streamAudio .audiostrm').mouseout(com.winamp.PromoteEvents.outThis);
			
	$('#promoteCont .slide .imgHolder').mouseover(com.winamp.PromoteEvents.addSkinBorder);
	$('#promoteCont .slide .imgHolder').mouseout(com.winamp.PromoteEvents.removSkinBdr);
	
	var fullWidth = 1024; // Width in pixels of full-sized image
	var fullHeight = 768; // Height in pixels of full-sized image
	var thumbnailWidth = 400;  // Width in pixels of thumbnail image
	var thumbnailHeight = 330;  // Height in pixels of thumbnail image
	var mainImage = '';
	$(document).click(com.winamp.PromoteEvents.hideoverlay);
	$("#sliderWalPaper .imgHolder a").click(function() {
		$("#full").attr({ src: '' });
		mainImage = $(this).attr("href");		
		$("#full").attr({ src: mainImage });
		$("#full12").attr({ src: mainImage });
		$("#main_view").css("display","block");
		return false;		
	});
	
	$('#full12').hide();
	
	$('#main_view .mainDiv').mouseover(function(){
	 	$('#full12').hide();
		$('#full').show();
	 });
	 $('#main_view .mainDiv').mouseout(function(){	
	 	$('#full12').attr({style: "width:400px;height:330px;"});
		$('#full12').show();
		$('#full').hide();			
	 });		
	 
	$("#close").click(function() {
		$("#main_view").css("display","none");				
	});
	$('#main_view .mainDiv').css({
        'width': thumbnailWidth+'px',
        'height': thumbnailHeight+'px',
		'border':'1px solid #ccc'
    });
	$('#main_view').mousemove(function(e) {			 
		var mouseX = e.pageX - $(this).attr('offsetLeft'); 
        var mouseY = e.pageY - $(this).attr('offsetTop'); 
        var posX = (Math.round((mouseX/thumbnailWidth)*100)/100) * (fullWidth-thumbnailWidth-20);
        var posY = (Math.round((mouseY/thumbnailHeight)*100)/100) * (fullHeight-thumbnailHeight-30);
        
        $('#full').css({
            'left': '-' + posX + 'px',
            'top': '-' + posY + 'px'
        });
		
    });
	/*------For TShirt Module--------*/
	var fullWTshirt = 1751; // Width in pixels of full-sized image
	var fullHTshirt = 1488; // Height in pixels of full-sized image
	var thumbnailWTshirt = 400;  // Width in pixels of thumbnail image
	var thumbnailHTshirt = 330;  // Height in pixels of thumbnail image
	$("#sliderTshirt .imgHolder a").click(function() {
		$("#full1_tshirt").attr({ src: '' });
		mainImage = $(this).attr("href");
		$("#full1_tshirt").attr({ src: mainImage });
		$("#full2_tshirt").attr({ src: mainImage });
		$("#main_tshirt").css("display","block");
		return false;		
	});
	
	$('#full2_tshirt').hide();
	
	$('#main_tshirt .mainDiv').mouseover(function(){
		$('#full2_tshirt').hide();
		$('#full1_tshirt').show();
	 });
	 $('#main_tshirt .mainDiv').mouseout(function(){	
		$('#full2_tshirt').attr({style: "width:400px;height:330px;"});
		$('#full2_tshirt').show();
		$('#full1_tshirt').hide();			
	 });		
	 
	$("#main_tshirt .close a").click(function() {
		$("#main_tshirt").css("display","none");				
	});
	$('#main_tshirt .mainDiv').css({
		'width': thumbnailWTshirt+'px',
		'height': thumbnailHTshirt+'px',
		'border':'1px solid #ccc'
	});
	$('#main_tshirt').mousemove(function(e) {			 
		var mouseX = e.pageX - $(this).attr('offsetLeft'); 
		var mouseY = e.pageY - $(this).attr('offsetTop'); 
		var posX = (Math.round((mouseX/thumbnailWTshirt)*100)/100) * (fullWTshirt-thumbnailWTshirt-30);
		var posY = (Math.round((mouseY/thumbnailHTshirt)*100)/100) * (fullHTshirt-thumbnailHTshirt-60);
		
		$('#full1_tshirt').css({
			'left': '-' + posX + 'px',
			'top': '-' + posY + 'px'
		});
		
	});
	/*------For Sticker Module--------*/
	var fullWSticker = 1500; // Width in pixels of full-sized image
	var fullHSticker = 1500; // Height in pixels of full-sized image
	var thumbnailWSticker = 400;  // Width in pixels of thumbnail image
	var thumbnailHSticker = 330;  // Height in pixels of thumbnail image
	$("#sliderSticker .imgHolder a").click(function() {
		$("#full1_sticker").attr({ src: '' });
		mainImage = $(this).attr("href");
		$("#full1_sticker").attr({ src: mainImage });
		$("#full2_sticker").attr({ src: mainImage });
		$("#main_sticker").css("display","block");
		return false;		
	});
	
	$('#full2_sticker').hide();
	
	$('#main_sticker .mainDiv').mouseover(function(){
		$('#full2_sticker').hide();
		$('#full1_sticker').show();
	 });
	 $('#main_sticker .mainDiv').mouseout(function(){	
		$('#full2_sticker').attr({style: "width:400px;height:330px;"});
		$('#full2_sticker').show();
		$('#full1_sticker').hide();			
	 });		
	 
	$("#main_sticker .close a").click(function() {
		$("#main_sticker").css("display","none");				
	});
	$('#main_sticker .mainDiv').css({
		'width': thumbnailWSticker+'px',
		'height': thumbnailHSticker+'px',
		'border':'1px solid #ccc'
	});
	$('#main_sticker').mousemove(function(e) {			 
		var mouseX = e.pageX - $(this).attr('offsetLeft'); 
		var mouseY = e.pageY - $(this).attr('offsetTop'); 
		var posX = (Math.round((mouseX/thumbnailWSticker)*100)/100) * (fullWSticker-thumbnailWSticker);
		var posY = (Math.round((mouseY/thumbnailHSticker)*100)/100) * (fullHSticker-thumbnailHSticker);

		$('#full1_sticker').css({
			'left': '-' + posX + 'px',
			'top': '-' + posY + 'px'
		});
		
	});
	/*------For Logos Module--------*/
	var fullWLogo = 480; // Width in pixels of full-sized image
	var fullHLogo = 330; // Height in pixels of full-sized image
	var thumbnailWLogo = 400;  // Width in pixels of thumbnail image
	var thumbnailHlogo = 330;  // Height in pixels of thumbnail image
	$("#sliderLogo .imgHolder a").click(function() {
		$("#full1_logo").attr({ src: '' });
		mainImage = $(this).attr("href");
		$("#full1_logo").attr({ src: mainImage });
		$("#full2_logo").attr({ src: mainImage });
		$("#main_logo").css("display","block");
		return false;		
	});
	
	$('#full2_logo').hide();
	
	$('#main_logo .mainDiv').mouseover(function(){
		$('#full2_logo').hide();
		$('#full1_logo').show();
	 });
	 $('#main_logo .mainDiv').mouseout(function(){	
		$('#full2_logo').attr({style: "width:400px;height:330px;"});
		$('#full2_logo').show();
		$('#full1_logo').hide();			
	 });		
	 
	$("#main_logo .close a").click(function() {
		$("#main_logo").css("display","none");				
	});
	$('#main_logo .mainDiv').css({
		'width': thumbnailWSticker+'px',
		'height': thumbnailHSticker+'px',
		'border':'1px solid #ccc'
	});
	$('#main_logo').mousemove(function(e) {
		var mouseX = e.pageX - $(this).attr('offsetLeft'); 
		var mouseY = e.pageY - $(this).attr('offsetTop'); 
		var posX = (Math.round((mouseX/thumbnailWLogo)*100)/100) * (fullWLogo-thumbnailWLogo);
		var posY = (Math.round((mouseY/thumbnailHlogo)*100)/100) * (fullHLogo-thumbnailHlogo);
		$('#full1_logo').css({
			'left': '-' + posX + 'px',
			'top': '-' + posY + 'px'
		});
	});
}

com.winamp.Distributions = function(){
	com.winamp.listOpen = false;
	com.winamp.formValid = false;
	com.winamp.formSubmitted = false;
	com.winamp.dropDownflag = 0;
	com.winamp.submitType = "plugin";
	$(document).click(com.winamp.PromoteEvents.hideSlide);
	$('#disDrp .dnBtn').mouseover(com.winamp.PromoteEvents.setValueHover);
	$('#disDrp .dnBtn').mouseout(com.winamp.PromoteEvents.setValueout);
	$(".dnBtn").click(com.winamp.PromoteEvents.slidingUpdown);
	$("#opnPopDist ul li a").click(com.winamp.PromoteEvents.getInnerhtml);
	$("#submit").click(com.winamp.PromoteEvents.validateForm);

	$("#customform").validate({
		rules: {
			firstname:{required:true,maxlength:100},
			lastname:{required:true,maxlength:100},
			email:{required:true,email:true},
			address:{required:true,maxlength:50},
			city:{required:true,maxlength:50},
			state:{required:true,maxlength:50},
			postalcode:{required:true,maxlength:50},
			country:{required:true,maxlength:50},
			pricategory:{required:true},
			description:{required:true,maxlength:50},
			TOS:{required:true}
		},
		messages: {
			firstname:{required:"Please enter the first name",maxlength:"first name needs to be max 100 chars"},
			lastname:{required:"Please enter the last name",maxlength:"last name needs to be max 100 chars"},
			email:{required:"Enter E-mail address"},
			address:{required:"Please enter the address",maxlength:"address needs to be max 50 chars"},
			city:{required:"Please enter the city",maxlength:"city needs to be max 50 chars"},
			state:{required:"Please enter the state",maxlength:"state needs to be max 50 chars"},
			postalcode:{required:"Please enter the postalcode",maxlength:"postalcode needs to be max 50 chars"},
			country:{required:"Please enter the country",maxlength:"country needs to be max 50 chars"},
			pricategory:{required:"Please choose one category"},
			description:{required:"Please enter the description",maxlength:"description needs to be max 50 chars"},
			TOS:{required:"Please read and agree to the terms and conditions in this agreement."}
		},
		success: function(label) {
	        label.addClass("valid").text("");
			com.winamp.formValid = true;
	    },
		errorPlacement: function(error, element) {
			error.appendTo( element.parent("div"));
			com.winamp.formValid = false;
		},
		submitHandler: function(form) {
			com.winamp.PromoteEvents.submitDistForm();
		}
	});
	
}

com.winamp.PromoteEvents = {
	setValueHover : function(){
		com.winamp.dropDownflag = 1;
	},
	setValueout : function(){
		com.winamp.dropDownflag = 0;
	},
	slidingUpdown : function() {
		com.winamp.dropDownflag = 1;
		if(!com.winamp.listOpen){
			$('#opnPopDist').css("display","block");
			com.winamp.listOpen = true;
		} else {
			$('#opnPopDist').css("display","none");
			com.winamp.listOpen = false;
		}
	},
	hideSlide : function(){
		if(com.winamp.dropDownflag == 0){
			$('#opnPopDist').css("display","none");
			com.winamp.listOpen = false;
		}
	},
	getInnerhtml : function(){
		innerhtml = $(this).html();
		$('#disfield').html(innerhtml);
		document.getElementById('cateSel').value = innerhtml;
		$("#customform").validate().element( "#cateSel" );
		com.winamp.listOpen = false;
	},
	validateForm : function(){
		$("#customform").submit();
		document.getElementById('errMsg').style.display = 'none';
	},

	submitDistForm : function() {

		if((com.winamp.formValid == true) && (com.winamp.formSubmitted == false)){
			try{
				com.winamp.organization = $('#company').attr('value');
				com.winamp.distFirstName = $('#firstname').attr('value');
				com.winamp.distLastName = $('#lastname').attr('value');
				com.winamp.distEmail = $('#email').attr('value');
				com.winamp.distHomePage = $('#homepage').attr('value');
				com.winamp.distPhone = $('#phone').attr('value');
				com.winamp.distAddress = $('#address').attr('value');
				com.winamp.distCity = $('#city').attr('value');
				com.winamp.distState = $('#state').attr('value');
				com.winamp.distPinCode = $('#postalcode').attr('value');
				com.winamp.distCountry = $('#country').attr('value');
				com.winamp.distMethod = $('#cateSel').attr('value');
				com.winamp.distPlan = $('#plan').attr('value');
				com.winamp.dataString = "company="+com.winamp.organization+"&firstName="+com.winamp.distFirstName+"&lastanme="+com.winamp.distLastName;
				com.winamp.dataString += "&email="+com.winamp.distEmail+"&homepage="+com.winamp.distHomePage+"&phone="+com.winamp.distPhone;
				com.winamp.dataString += "&address="+com.winamp.distAddress+"&city="+com.winamp.distCity+"&state="+com.winamp.distState;
				com.winamp.dataString += "&postalcode="+com.winamp.distPinCode+"&country="+com.winamp.distCountry+"&method="+com.winamp.distMethod+"&plan="+com.winamp.distPlan;
				com.winamp.formSubmitted  = true;
				
				$.ajax({
					type: "POST",
					url: com.winamp.updateDistributionUrl,
					data: com.winamp.dataString,
					timeout: 50000,
					success: function(objectResponse, statusText) {
						var responseText = objectResponse.replace(/^\s+|\s+$/, '');
						if(responseText == 200) {
							document.getElementById('distributeSubmit').style.display = 'none';
							document.getElementById('errMsg').style.display = 'block';
							$("#errMsg").html("Thanks for submitting the information. You can now distribute Winamp for free. ");
						} else {
							document.getElementById('errMsg').style.display = 'block';
							$("#errMsg").html("Failed to save data, Please Try again later");
						}
							com.winamp.formSubmitted = false;
					},
					error: function(objectRequest, statusText) {
						com.winamp.formSubmitted = false;
						document.getElementById('errMsg').style.display = 'block';
						$("#errMsg").html("Failed to save data, Please Try again later");
					}
				});
			}catch(e){
				document.getElementById('errMsg').style.display = 'block';
				$("#errMsg").html("Failed to save data, Please Try again later");
			}
		}
		
	},
	hoverNext : function() {
		$(this).find('span').attr({style: "background:url('"+ cdnUrl +"/main/img/home.png') no-repeat -115px -579px;"});
	},
	hoverPrev : function() {	
		$(this).find('span').attr({style: "background:url('"+ cdnUrl +"/main/img/home.png') no-repeat 0 -579px;"});
	},
	outPrev : function() {
		$(this).find('span').attr({style: "background:url('"+ cdnUrl +"/main/img/home.png') no-repeat -112px -256px;"});
	},
	outNext : function() {
		$(this).find('span').attr({style: "background:url('"+ cdnUrl +"/main/img/home.png') no-repeat 0 -256px;"});
	},
	showPop : function() {
		var arrid = this.id;
		var arrsplit = arrid.split('_');
		com.winamp.choseId = arrsplit[1];
		document.getElementById('firstcheck').checked = true;
		var downloadurl = "http://o.aolcdn.com/art/winamp/promote/wallpaper0"+com.winamp.choseId+"_800x600.jpg";
		$('#popupPromote .download a').attr({ href: downloadurl });		
		$('#promoteOverlay').css( {display: 'block'} );
		window.scrollTo(0, -100);
		$('#promoteOverlay_bg').css( {height: $(document).height(), width: $(document).width()} );
	},
	hoverThis : function() {
		var clasArr = this.className;
		var classNm = clasArr.split(' ');
		if(classNm[1] == 'audioimg'){
			$(this).removeClass("audioimg");
			$(this).addClass("audioimgHover");
		} else {
			$(this).removeClass("pauseimg");
			$(this).addClass("pauseimgHover");
		}
	},
	outThis : function() {
		var clasArr = this.className;
		var classNm = clasArr.split(' ');
		if(classNm[1] == 'audioimgHover'){
			$(this).removeClass("audioimgHover");
			$(this).addClass("audioimg");
		} else {
			$(this).removeClass("pauseimgHover");
			$(this).addClass("pauseimg");
		}
	},
	addSkinBorder : function() {
		$(this).addClass('imgHolderHover');
		$(this).removeClass('imgHolder');
	},
	removSkinBdr : function() {
		$(this).removeClass('imgHolderHover');
		$(this).addClass('imgHolder');			
	},
	hideoverlay : function() {
		$('#main_view').css('display','none');
		$('#main_tshirt').css('display','none');
		$('#main_sticker').css('display','none');
		$("#main_logo").css("display","none");
	}
}
var isFirst_Song1 = 0, isFirst_Song2 = 0, isFirst_Song3 = 0;
function playMpThree(url,id) {
	var clasArr = document.getElementById(id).className;
	var classNm = clasArr.split(' ');
	if(classNm[1] == 'audioimgHover'){
		 document.getElementById(id).className = "audiostrm pauseimgHover";
	} else if(classNm[1] == 'pauseimgHover') {
		document.getElementById(id).className = "audiostrm audioimgHover";
	}
	try {
	if(id == "song_1") {
		if(isFirst_Song1 == 0) {
			var songVoObj = new streampadPlayer.SongVO();
			songVoObj.enclosure = url;
			songVoObj.text = "Madonna";	
			songVoObj.plays = 1;
			streampadPlayer.vars.queueNumber = 0;
			streampadPlayer.Playlist.push(songVoObj);
			streampadPlayer.Play.songVO(songVoObj);
			streampadPlayer.Playlist.array.length = 1;
			document.getElementById('song_2').className = "audiostrm audioimg";
			document.getElementById('song_3').className = "audiostrm audioimg";
			isFirst_Song1 = 1, isFirst_Song2 = 0, isFirst_Song3 = 0 ;
		} else {
			streampadPlayer.Events.playTrack();
		}
	} else if(id == "song_2") {
		if(isFirst_Song2 == 0) {
			var songVoObj = new streampadPlayer.SongVO();
			songVoObj.enclosure = url;
			songVoObj.text = "Madonna";	
			songVoObj.plays = 1;
			streampadPlayer.vars.queueNumber = 0;
			streampadPlayer.Playlist.push(songVoObj);
			streampadPlayer.Play.songVO(songVoObj);
			streampadPlayer.Playlist.array.length = 1;
			document.getElementById('song_1').className = "audiostrm audioimg";
			document.getElementById('song_3').className = "audiostrm audioimg";
			isFirst_Song1 = 0, isFirst_Song2 = 1, isFirst_Song3 = 0 ;
		} else {
			streampadPlayer.Events.playTrack();
		}
	} else if(id == "song_3") {
		if(isFirst_Song3 == 0) {
			var songVoObj = new streampadPlayer.SongVO();
			songVoObj.enclosure = url;
			songVoObj.text = "Madonna";	
			songVoObj.plays = 1;
			streampadPlayer.vars.queueNumber = 0;
			streampadPlayer.Playlist.push(songVoObj);
			streampadPlayer.Play.songVO(songVoObj);
			streampadPlayer.Playlist.array.length = 1;
			document.getElementById('song_1').className = "audiostrm audioimg";
			document.getElementById('song_2').className = "audiostrm audioimg";
			isFirst_Song1 = 0, isFirst_Song2 = 0, isFirst_Song3 = 1 ;
		} else {
			streampadPlayer.Events.playTrack();
		}
	}
	} catch(e) {}
}

function checkVal(val) {
	var downloadurl = "http://o.aolcdn.com/art/winamp/promote/wallpaper0"+com.winamp.choseId+"_"+val+".jpg";
	$('#popupPromote .download a').attr({ href: downloadurl });	
}
