// JavaScript Document
// (c) Thinkcyber.com

var valume = '';
//var currentVolume = -1



var myFlash = "";
myFlash = $.flash({   swf: 'player.swf',
					width: 290,
					height: 24,
					allowfullscreen: 'true',
					flashvars: { soundFile: "/marinakamen/includes/mp3/1.mp3,/marinakamen/includes/mp3/2.mp3,/marinakamen/includes/mp3/3.mp3",titles: "Walk On,You are Everything,Last Christmas",artists:"U2,Mary J. Blye,George Michael",autostart: "no", text: '0xE40D8A' }  });


$.fn.showIf = function( show, arg ) {
   return this[ show ? 'show' : 'hide' ]( arg );

};

			jQuery(document).ready(function() {
				
					$(function() {
					$('#pane1')
					.jScrollPane(
						{
							showArrows:true
						}
					);
					});

			//$('#pane1').jScrollPane({showArrows:true});

				$('#audioplayer_1').html(myFlash);
				$('#audioplayer_2').hide();
				$('#videotitle').hide();
				$('#add_to_cart').hide();
				$('#buyf').hide();
				$('#buyf1').hide();
				$('#buyf2').hide();
				$('#itunes').hide();
				$('.click_on_each').fadeOut(800).fadeIn(800).fadeOut(800).fadeIn(800).fadeOut(800).fadeIn(800);


				listensound = function(id,pt,subcat,mp3,artist,title,myImage,myPrice,myPrice1,myPrice2,itunes){
				//alert("MP3 File" +mp3)
					$('#click_play').hide();
					$('#audioplayer_1').hide();
					$('#add-to-cart').fadeIn(800).fadeOut(800).fadeIn(800).fadeOut(800).fadeIn(800).fadeOut(800).fadeIn(800);
					function convertQuotes(string){
							return string.replace(/##/g,"'");
							return string.replace(/###/g,"\"");
							return string.replace(/%%/g,"(");
							return string.replace(/%%%/g,")");
					}
					 
					var myImageindex = (myImage.indexOf(".jpg"));
					//alert("Hello " + myImageindex);
					var titlenew = '';
					titlenew = convertQuotes(title);
					var map3new = convertQuotes(mp3);
					$('#audioplayer_2')
					//http://www.youtube.com/v/VG6DlDhmjw8&enablejsapi=1&playerapiid=audioplayer_2',
					
					.flash({   swf: mp3,
										width: 425,
										height: 356,
										allowScriptAccess: 'always',
										allowfullscreen: 'true'
						  });
					$('#audioplayer_2').show();
	
						
							var myImagesrc = "<img src='/marinakamen/images/icons/icon130/";
							var myImagesrc1 = ".gif' width='130' height='130' border='0'>";
							var myImagecover = myImagesrc + subcat + myImagesrc1;
	
					//alert("Image File " +myImagecover)
					
					var myitunes = itunes;
					if (myitunes != "") {
							var base = '<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?id=';
							var base1 = '&amp;s=143441" title="Get it now in iTunes" target="_blank"><img src="images/itunes_111_18.gif" id="itunesimg" height="18" vspace="2" width="111" alt="Get it now in iTunes" border="0" /></a>';
							var dispitune = base + myitunes + base1;
					$('#itunes').html(dispitune);
					$('#itunes').show();
					} else {
						$('#itunes').hide();
					}
					$('#coverholder').remove();
					$('#videotitle').html(titlenew);
					$('#videotitle').show();
					$('#add_to_cart').show();
					$('#buyf').show();
					$('#buyf1').hide();
					$('#buyf2').hide();

					$('#myPrice').html("$" + myPrice);
					$('.product_id').val(id);
					$('.product_type').val(pt);
					$('.product_subtype').val(subcat);
					$('.product_downloadonly').val(myitunes);
					
					if(myPrice1 != ""){
						$('#myPrice1').html("$" + myPrice1);
						$('#buyf1').show();
					}
					
					if(myPrice2 != ""){
						$('#myPrice2').html("$" + myPrice2);
						$('#buyf2').show();
					}
					
					switch(pt)
						{
						case "1":
							var fileid = "/marinakamen/marina_video01.php?id="+id;
							break;
						case "2":
							var fileid = "/marinakamen/marina_video02.php?id="+id;
							break;
						case "3":
							var fileid = "/marinakamen/marina_video03.php?id="+id;
							break;
						case "4":
							var fileid = "/marinakamen/marina_video04.php?id="+id;
							break;
						default:
							var fileid = "/marinakamen/marina_video01.php?id="+id;
							break;
						}

					$("#loading").html('<p><img src="images/ajax-loader.gif" width="100" height="19" alt="Please wait.." /></p>');
					
					ajaxify(fileid);
					
					//<img src="audiocdimages/pro_7.jpg" width="90" height="90" class="field" border="0">
				
				
				}
				
				//@ ajax function get page content
				function ajaxify(file){
						//@ loading message
						//$('<div id="loading"></div>').html("Loading Content: "+file+" ...").appendTo('#wrapper').fadeIn();
						//$("#loading").html('<p><img src="images/ajax-loader.gif" width="100" height="19" alt="Please wait.." /></p>');
						//@ http GET request
						
						$.get(file,function(data) {
							//@ add data to wrapper div, fade it slowly
							
							$("#wrappervideo").slideDown('slow',function(){
								$(this).html(data).fadeIn('slow',function(){
									$('#loading').fadeOut('slow',function(){$(this).remove();});
								});
							});
						});
					}
				$(".stripeMe>tbody>tr")
					   //.not(":first,:last")
				
				.hover( function() {
				$(this).addClass("over");
					   },function() {
						   $(this).removeClass("over");
					   })
				.click( function(e) {
					$(this).addClass('highlight played');
					$(this).removeClass("alt");
					$(this).siblings().removeClass('highlight');
					$(this).removeClass("over");
				})
				.filter(":even")
				.addClass("alt");
	
				//$("a[@rel]").click(function() {
				
				//$("#container_shop").load("http://www.marinaonline.com/marinakamen/cart_output.php", {thread_count: this.rel});
				
				//return false; ?product_id=201&product_type=4&without=Buy
				
				//});
				$(".buyform").submit(function() {
				var product_idval = $(".product_id:eq(0)").val();
				var ptval = $(".product_type:eq(0)").val();
				var psubval = $(".product_subtype:eq(0)").val();
				var downloadval = $("#product_downloadonly").val();
				var withoutval = "with";
				//alert("Buyform " +withoutval);
				$.get("add_product.php", { product_id: product_idval, 
				product_type: ptval, withone: withoutval, product_subtype: psubval, product_downloadonly: downloadval}, function(data) {
				//alert("Amount: " + product_idval)
					$("#container_shop").html(data);
					});
				return false;
				});
	
				$(".buyform1").submit(function() {
				var product_idval = $(".product_id:eq(1)").val();
				var ptval = $(".product_type:eq(1)").val();
				var psubval = $(".product_subtype:eq(1)").val();
				//var downloadval = $(".product_downloadonly:eq(1)").val();
				var withoutval = "without";
				//alert("buyform1 " +withoutval);
				$.get("add_product.php", { product_id: product_idval, 
				product_type: ptval, without: withoutval, product_subtype: psubval}, function(data) {
				//alert("Amount: " + product_idval)
					$("#container_shop").html(data);
					});
				return false;
				});
	
				$(".buyform2").submit(function() {
				var product_idval = $(".product_id:eq(2)").val();
				var ptval = $(".product_type:eq(2)").val();
				var psubval = $(".product_subtype:eq(2)").val();
				var withoutval = "both";
				//alert("buyform2 " +withoutval);
				$.get("add_product.php", { product_id: product_idval, 
				product_type: ptval, both: withoutval, product_subtype: psubval}, function(data) {
				//alert("Amount: " + product_idval)
					$("#container_shop").html(data);
					});
				return false;
				});
	
				function buynow(file){
						//@ loading message
						//$('<div id="loading"></div>').html("Loading Content: "+file+" ...").appendTo('body').fadeIn();
						//@ http GET request
						$.get(file,function(data) {	
							//@ add data to wrapper div, fade it slowly
							$("#wrapper").slideUp('slow',function(){
								$(this).html(data).slideDown('slow',function(){
									$('#loading').fadeOut('slow',function(){$(this).remove();});
								});
							});
						});
					}
				/*function example_ajax_request() {
					$('#example-placeholder').html('<p><img src="/images/ajax-loader.gif" width="220" height="19" /></p>');
					$('#example-placeholder').load("/examples/ajax-loaded.html");
				}
				
				$("#clickme").click( function() {
							  $('#example-placeholder').html('<p><img src="images/ajax-loader.gif" width="220" height="19" /></p>');
							  setTimeout('example_ajax_request_go()', 2000);

							function example_ajax_request_go() {
							  $('#example-placeholder').html('<p>We are done.</p>');
							}
				});
				
				
							$("#bill_to_co").is(":checked") 
				$("#shipping_fieldset input, #shipping_fieldset select").each(function() {
				    var elem = $(this);
				    $("#billing_fieldset #"+ 
				        elem.attr("id").replace(/shipping/, "billing")).val(elem.val());
				});

				*/


	});	
