var libraryImageBase="";
var linkURLBase="";
var catelogImageBase="";

var quickviewlink = "";
var picker = null;
var miniCart = null;
var tipImg = "";
var qvOpen = false;
	
addLoadEvent(function() {
	minicartConstants.easyViewerAddToBag = false;

	quickviewlink = $('quickViewURL').href;
	linkURLBase = quickviewlink.replace("Product-ShowQuickView","");
	libraryImageBase = $('defaultImgURL').src.replace("images/spacer.gif","");
	catelogImageBase = libraryImageBase.replace('Library', 'catalog');
	tipImg='<img src="'+libraryImageBase+'images/nw_icon_quickView.gif" alt="" align="top" />';
	var jsonImages = '[{ "id":"_1", "user" :  "deirdre.jpg", "expert" : "lloyd_boston", "large" : "deirdre.jpg","question" : "<p>What is a good winter coat style to wear if I&#39;m bottom heavy with a bit of a thick middle and 5&#39; 3&rdquo; </p>","answer" : "<p>Dear Deirdre,<br />You are not alone.  Like many women, your curves are more proud below your waistline.  The ideal coat for you would be a tailored A-Line coat that floats atop your thighs and rear.  This will minimize these areas that might overpower your entire figure.  Also, go for fabrics that have body (wool, cashmere), to add balance and proportion to your silhouette.</p>", "videolink" :"","maps": [{"sellStatus":"available","shape":"poly", "prodId":"22959221","coords": "357,128, 374,106, 438,129, 458,189, 506,255, 496,301, 473,352, 450,355, 439,455, 253,414, 229,384, 263,338, 282,287, 266,250, 292,195, 339,161, 351,161" }, {"sellStatus":"available","shape":"poly", "prodId":"22954413", "coords": "88,47, 122,11, 154,17, 227,71, 287,186, 282,213, 234,216, 237,299, 63,306, 58,221, 22,196, 25,100" }]},{ "id":"_3", "user" :  "jennifer.jpg", "expert" : "lloyd_boston", "large" : "jennifer.jpg", "question" : "<p>Hi, I am a woman in my mid 40&#39;s who needs a new style.  I have a full\/large bustline, small hips, waist in proportion to hips.  &nbsp;I have worn jeans and blouses the last several years and would like a more flattering look. I would like to accentuate my curves, not hide them.  Can you offer suggestions? Thanks!</p> ","answer" : "<p>Hi Jennifer!<br /> Hi!  How about this: upgrade your denim to fitted, darker wash jeans with a slightly lower rise. You can also alternate your tucked blouses for un-tucked, body skimming knit tops and lightweight sweaters.&nbsp;These two choices will emphasize your figure, and update your style just a slight bit.  You\'re not as far off as you might think.</p> ","videolink" :"","maps": [{"sellStatus":"available","shape":"poly", "prodId":"22953917", "coords": "216,61, 212,149, 256,220, 309,237, 328,264, 245,344, 278,418, 260,426, 245,426, 225,363, 185,404, 160,369, 149,339, 150,322, 91,287, 64,298, 9,249, 17,183, 9,162, 12,142, 73,80, 120,80, 133,88, 142,77" },{"sellStatus":"available","shape":"poly", "prodId":"22957497", "coords": "250,346, 284,419, 260,430, 241,430, 223,370, 216,434, 328,434, 328,276, 340,263, 331,254, 332,222, 366,314, 388,434, 503,434, 464,297, 432,112, 396,14, 376,19, 302,21, 240,28, 225,25, 225,40, 218,59, 216,146, 259,216, 308,231, 335,264" }]},{ "id":"_5", "user" :  "linda.jpg", "expert" : "lloyd_boston", "large" : "linda.jpg","question" : "<p>Hi Lloyd, as a women in her 40&#39;s I suddenly had major body and health changes.  I was always a size 4 and tiny.  Now I gained a lot of weight, especially around the middle.  Many styles I always wore are not doable anymore. Any advice?</p> ","answer" : "<p>Dear Linda,<br/> Firstly, you look gorgeous! If your middle concerns you: <br/>-Reveal/highlight the bust to your comfort<br/>-Tie-front tops give a visual cinching to the &nbsp;middle <br/>-Rouching (a French term for gathering) can also visually pull you in.<br/>I would also advise you to try the one-for-one approach.  For every one area you hide, consider revealing another to balance things out. For instance, if you are hiding your stomach, show off your shoulders and d&eacute;colletage.  Hate your rear? Hide it, but show off your back if it shines.<br/>Keep doing what you are doing! </p> ","videolink" :"","maps": [{"sellStatus":"available","shape":"poly", "prodId":"22957832", "coords": "326,445, 229,462, 80,459, 76,266, 144,260, 161,287, 168,291, 207,269, 211,261, 252,263, 320,283" },{"sellStatus":"available","shape":"poly", "prodId":"22949257", "coords": "212,10, 274,11, 315,37, 311,92, 313,115, 303,140, 298,150, 315,232, 326,279, 322,279, 249,259, 201,258, 205,268, 164,287, 96,182, 107,83, 168,33, 206,23" },{"sellStatus":"available","shape":"poly", "prodId":"22957228", "coords": "344,24, 380,23, 411,23, 428,140, 424,246, 424,467, 340,475, 335,363, 330,283, 321,236, 305,173, 303,148, 317,113, 315,87, 317,31" }]}]';
	objImages.init(jsonImages, libraryImageBase+'images/askexperts/');
});
   
Effect.OpenUp = function(element) {
     element = $(element);
     $('slider').className="normal";
    
     new Effect.BlindDown(element, { duration: .4, afterFinish: function(effect) 
		{$('tabLink').className="opened"; 
		}});
     
 }

 Effect.CloseDown = function(element, mainImg) {

     element = $(element);
     if (mainImg != null)
     {
	objImages.setLargeImage(mainImg);
	}
	//	$('mainImage').src=mainImg;
     new Effect.BlindUp(element, { duration: .4, afterFinish: function(effect) 
		{$('slider').className="scrunched";
		
		$('tabLink').className="closed";
		
		}});
 }

Effect.Combo = function(element, mainImg, x) {
var z = arguments;
     element = $(element);
     if(element.style.display == 'none') { 
          new Effect.OpenUp(element, arguments[2] || {}); 
     }else { 
          new Effect.CloseDown(element, x, arguments[2] || {}); 
     }
 }
 
		function setMousePos(event){
			mXPos = Event.pointerX(event);
			mYPos = Event.pointerY(event);
		}

		function getProductContent(productID)
		{
			//productID = 22957176;
			if(qvOpen)
				cleanqv();
			if (BrowserDetect.browser == "Safari" && BrowserDetect.version < 500)
			{
				var url = linkURLBase+'Product-Show?pid=' + productID;
				window.open(url, "windowName", "width=800, height=650, resizable=yes, status=no, scrollbars=yes");
				//window.open("browse/product.s?productId="+productID,"windowName", "width=800,height=650, resizable=yes, status=yes,location=no, scrollbars=yes");
				return;
			}

			currentProdLink = linkURLBase+'Product-Show?pid=' + productID;
			 var url = quickviewlink+'?pid='+productID;
			var result  ='';
			$('ajax_loading').style.display     = "block";
			$('productContent').style.display     = "none";
			var request = new Ajax.Updater('productContent', url, 
			{ 
			  method:'get',
			  evalScripts:false,
			  onSuccess: function(transport)
			  {
				if(transport.responseText.indexOf('<input type="hidden" value="errorPage"/>') != -1)
				{
					setTimeout("showSoldOutMsg()",1000);
				} 
				if(transport.responseText.indexOf('We are sorry!') != -1)
				{
					setTimeout("showSoldOutMsg()",1000);
				}
				else
				{
					setTimeout("initSkuPicker()",1000);
				}
			  },
			  onFailure: function()
			  {
			   // do nothing for now
			  }
			}
		  );
		 }
		function closeQuickview() {
			cleanqv();
		}

		function cleanqv() {
			$('productContent').innerHTML = "";
			$('productContent').style.display = "none";
			
			miniCart = null;
			
			picker = null;
			closeDiv = null;
			closeAnchor = null;
			graphicDiv = null;
			graphicAnchor = null;

			qvOpen = false;
		}
		function initSkuPicker()
		{
			$('quickViewRight').insertBefore($('quickViewDesc'),$('cartControls'));
			try{
				picker = new skuPicker(eval($('lookupTable').value)[0],'','quickView',eval($('imagesLookupTable').value)[0], true);
				picker.init();
				miniCart.initialize();
			} catch(e) {
				alert("Problem Creating Skupicker and Minicart. Problem: "+e.description);
			}

			qvOpen = true;
			var closeDiv = $('quickViewClose');
			var closeAnchor = closeDiv.getElementsByTagName('a');
			if(closeAnchor[0])
				closeAnchor[0].href = "javascript:closeQuickview();"

			var graphicDiv = $('quickViewImgHolder');
			var graphicAnchor = graphicDiv.getElementsByTagName('a');
			if(graphicAnchor[0])
				graphicAnchor[0].href = currentProdLink;
			$('ajax_loading').style.display = "none";
			$('productContent').style.display = "block";
		}
		function showSoldOutMsg()
		{
			$('productContent').innerHTML = '<div style="float:left;background-color:#FAF6EB;border:8px solid #EFE7DA;width:300px;"><div style="padding:20px;float:left;font-size:14pt;">So Hot, It&#39;s Sold Out</div><div id="quickViewClose"><a href="javascript:closeQuickview();" class="evQuickViewCloseHandle"><img alt="Close" src="/on/demandware.static/Sites-jonesny-Site/-/default/v1221223098384/images/cart/close_icon.gif"/></a></div></div>';
			$('ajax_loading').style.display = "none";
			$('productContent').style.display = "block";
		}
