$(document).ready(function(){ 
   	$(function() {
    $(".mycarousel").jCarouselLite({
        	btnNext: ".next",
        	btnPrev: ".prev",
        	vertical: "true",
        	visible: 4
    	});
	});
	$("#girlbox > a").each(function() 
		{
   		$(this).qtip({ 
		    content: {
		    url: '/newlws/module/girls/getcard.php',
      		data: { id: $(this).attr('tooltip') },
      		method: 'get'
			},
			position: { adjust: { screen: true } },
			style: { 
			 width: 240,

      			border: {
        		 width: 7,
        		 radius: 5,
        		 color: '#2f1678'
      			},
      			background: '#ffffff'
   			}

		}); 
	});
});



function divSize() {
	var imgWidth = $("#thebigimage").width();
	var imgHeight = $("#thebigimage").height();
	var newHeight = imgHeight + 50;
	var leftalignment = (700/2)-(imgWidth/2);
	var topalignment = 0;
	
	//alert (leftalignment + " " + topalignment);
	$("#fullimage").css({ height: newHeight, width: imgWidth, left: leftalignment, top: '-50px'  });

}






function updateVideos() {
//alert(productid + " - " + addtocart);
var videotype = $("#videotype").val();
var wrestler = $("#wrestler").val();
//alert (wrestler);
content = "Loading Cart...";
//alert(content);
$("#mycarousel").html(content);
$.get("/newlws/module/cart/generate_carousel_list.php", { videotype: videotype, wrestler: wrestler }, function(data){
   		finishVideos(data);
	 });
return false;
}

function finishVideos(content){
	//alert(content);
	$("#mycarousel").html(content);
	$(function() {
    	$(".mycarousel").jCarouselLite({
        	btnNext: ".next",
        	btnPrev: ".prev",
        	vertical: "true",
        	visible: 4
    	});
	}); 

}

function updateVideosDetails(id) {
content = "Loading Video...";
//alert(content);
$("#dvddescription").html(content);
$.get("/newlws/module/cart/dvd_videodetails.php", { id: id }, function(data){
   		finishVideosDetails(data, id);
	 });
return false;
}

function finishVideosDetails(content, id) {
	//alert(content);
	$("#dvddescription").html(content);
	$("#choose").html('<input type="button" value="Add this video" onclick="AddDVD(' + id + ');"/>');
	

}

function AddDVD(id) {
	//alert(id);
	$.get("/newlws/module/cart/addtocartdvd.php", { video: id }, function(data){
   		finishAddDVD(data);
	 });
}

function finishAddDVD(content) {
	temp = content.split('|');
	//alert (temp[0]);
	//alert (temp[1]);	
	//alert (temp[2]);
	//alert(content);
	$("#dvdivideo" + temp[0]).attr("src",temp[1]);
	$("#videooverlay" + temp[0]).html(temp[2]);
	if (temp[0] == 1) {
			$("#clear").html('<input type="button" value="Clear" onClick="window.location.reload()"/>');
	}
	if (temp[0] == 2) {
		$("#add").html('<input type="button" value="Add to Shopping Cart" onclick="AddShopping();"/>');
		$("#choose").html('<input type="button" value="Add this video" class="disabledbutton" disabled />');
	}
}

function AddShopping() {
	$.get("/newlws/module/cart/dvd_order.php", function(data){
   		updateCart();
	 });
}

