var NOTES_TEXT = 'Notes:\nMarketplace Safety Tip Always remember to complete your transactions on LinkChina - it\'s the safer way to trade. Is this message an offer to buy your item directly through email without purchasing the item on LinkChina? If so, please help make the Linkchina marketplace safer by reporting it to us. These "outside-of-LinkChina" transactions may be unsafe and are against LinkChina policy.';
$(document).ready(function(){

	$(function(){
		$("#messagenote").val(NOTES_TEXT);
		$("#messagenote").css('color','#999');
	})

	$("#messagenote")
		.mousedown(function(){
			if($.trim($(this).val()) == NOTES_TEXT ){
				$(this).val("");
				$(this).css('color','#000');
			}
		})
		.blur(function(){
			if($.trim($(this).val()) == "" ){
				$(this).val(NOTES_TEXT);
				$(this).css('color','#999');
			}

			
		})
		.keyup(function(){
			cacaulate($(this).val(),'messagenote',null,1000);
		});

	//$("h2").append('<em></em>')
	$(function() {
		$("#box").jCarouselLite({
			btnNext: ".next",
			btnPrev: ".prev"
		});
	});


	$("#mycarousel a").click(function(){
	


		var previewPath = $(this).attr("href");
		var finalPath = _genaratePhotoUrl(previewPath);
		//var largeAlt = $(this).attr("title");
		$("#largeImg").attr({ src: previewPath});	
		$("#largeImg").load(function(){
			$("#largeImg").hide();
			$("#thumb_preview").attr('href',finalPath);
			$("#largeImg").fadeIn();
		})
		return false;
		
		//$("h2 em").html(" (" + largeAlt + ")"); 
	});	
	function _genaratePhotoUrl(originalURL){
		//var secondDomain = originalURL.split(".");
		//secondDomain = secondDomain[0].slice(6);
//		if(secondDomain.indexOf("image3") != -1){
//			secondDomain = "image1";
//		}
//		if(secondDomain == "\/image"){
//			secondDomain = "image"
//		}
		//window.status = "secondDomain:  "+secondDomain;
		var largePhotoUrl = originalURL.split("\/image");
		//largePhotoUrl = "http://" + secondDomain + ".linkchina.com/" + largePhotoUrl[3] + "/" + largePhotoUrl[4] + "/" + largePhotoUrl[5] + "/" + largePhotoUrl[6].slice(3);

		return largePhotoUrl;
	}
	$("#prdctAbbrImg img").hover(
		function(){
			$(this).css("border-color", "#6a6a6a");
		},
		function(){
			$(this).css("border-color", "#aaa");
		}
	);

	$("#panel_mask").click(
		function(){
			closeMask();
		}				   
	);
	  
	  
});