//requires jquery

$(document).ready(function(){
	//toggle visibility
	$('#shipTo1').click(function () { $('#ship-info').show(); $('#ship-info-2').hide(); });
	$('#shipTo2').click(function () { $('#ship-info').hide(); $('#ship-info-2').show(); });
	$('#overnight').click(function() { $('#countdown').show(); });
	$('#express').click(function() { $('#countdown').hide(); });
	$('#firstClass').click(function() { $('#countdown').hide(); });
	$("#needOvernight").click(function() { 
		if (this.checked) { $('#addMessage1,#cardAmount1').hide(); $('#addMessage2,#cardAmount2').show(); }
		else { $('#addMessage1,#cardAmount1').show(); $('#addMessage2,#cardAmount2').hide(); }
	});
	
	//shopping cart popup
    $("#cart-link").click(function () {
    	$("#cart").toggle();
    	$(this).toggleClass("cart-link-on");
    	this.blur();
    });
    
    //modal overlays
//    $("#gcard").append('<div id="gcard-modal-1" class="jqmWindow gcard-modal"><a href="javascript:;" class="btnClose"><span>Close</span></a></div>');
//    $('#gcard-modal-1').append(
//    	'<div class="top">' +
//    		'<h4>Simon Giftcard</h4>' +
//    		'You have selected Simon Giftcard<br/><br/>Simon Malls Visa Giftcards offer flexibility, personalization and convenience for everyone on your shopping list. You can buy your gift card online and have it shipped quickly or delivered instantly via an ecard. Our gift cards are also available in a variety of designs in any amount, so it makes it easy to give a custom gift they\'re sure to love. Plus, they can be used anywhere Visa debit cards are accepted, quite possibly making them the perfect gift card!' +
//    		'<br/><br/>' +
//    		'<div class="desc">The purchaser or the recipient (if under $150.00) will recieve a physical card in the mail. After you choose one of our designs below click the next button and you will be taken to the next steps, including personalization, shipping and billing information.</div>' +
//    	'</div>' +
//    	'<div class="tabBlue">' +
//			'<div class="tabBlueImg"><img title="" alt="" src="img/simon-giftcard.png"/></div>' +
//			'<div class="tabBlueText">Select a card image below to buy your Simon Giftcard<sup>(r)</sup> now!</div>' +
//			'<ul><li><a href="#"><img title="" alt="" src="img/simon-giftcard-1.png"/></a></li>' +
//				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-2.png"/></a></li>' +
//				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-3.png"/></a></li>' +
//				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-4.png"/></a></li>' +
//				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-5.png"/></a></li>' +
//			'</ul>' +
//			'<ul><li><a href="#"><img title="" alt="" src="img/simon-giftcard-6.png"/></a></li>' +
//				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-7.png"/></a></li>' +
//				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-8.png"/></a></li>' +
//				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-9.png"/></a></li>' +
//			'</ul>' +
//			'<div class="clear"></div>' +
//		'</div>' +
//		'<div class="bottom"><img src="img/btn-next.png" style="float:right"/><a class="cancel" href="#" style="float:right;padding:5px 10px 0 0">Cancel</a></div>'
//    );
//    
//    $("#gcard").append('<div id="gcard-modal-2" class="jqmWindow gcard-modal"><a href="javascript:;" class="btnClose"><span>Close</span></a></div>');
//    $('#gcard-modal-2').append(
//        	'<div class="top">' +
//        		'<h4>Simon Giftaccount</h4>' +
//        		'You have selected Simon Giftaccount for Simon Email Delivery.<br/><br/>Please confirm the email address for the recipient and purchaser to ensure accuracy' +
//        		'<br/>' +
//        		'<div class="form-item"><label>*Recipient Email Address:</label> <input type="text" style="width:275px" /></div>' + 
//        		'<div class="form-item"><label>*Purchaser\'s Email Address:</label> <input type="text" style="width:275px" /></div>' +
//        		'<div class="clear"></div>' +
//        		'<input type="checkbox"/><span class="small">Recipient is 13 years or older</span><br/><br/>' + 
//        		'<div class="desc">Simon Email Delivery: The recipient will receive an email with the giftaccount details. The recipient will not get a physical card by mail. However, the recipient will have the option to convert to a physical card.</div>' +
//        	'</div>' +
//        	'<div class="tabBlue">' +
//    			'<div class="tabBlueImg"><img title="" alt="" src="img/simon-giftcard.png"/></div>' +
//    			'<div class="tabBlueText">Select a card image below to buy your Simon Giftcard<sup>(r)</sup> now!</div>' +
//    			'<ul><li><a href="#"><img title="" alt="" src="img/simon-giftcard-1.png"/></a></li>' +
//    				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-2.png"/></a></li>' +
//    				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-3.png"/></a></li>' +
//    				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-4.png"/></a></li>' +
//    				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-5.png"/></a></li>' +
//    			'</ul>' +
//    			'<ul><li><a href="#"><img title="" alt="" src="img/simon-giftcard-6.png"/></a></li>' +
//    				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-7.png"/></a></li>' +
//    				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-8.png"/></a></li>' +
//    				'<li><a href="#"><img title="" alt="" src="img/simon-giftcard-9.png"/></a></li>' +
//    			'</ul>' +
//    			'<div class="clear"></div>' +
//    		'</div>' +
//    		'<div class="bottom"><img src="img/btn-next.png" style="float:right"/><a class="cancel" href="#" style="float:right;padding:5px 10px 0 0">Cancel</a></div>'
//        );
    
    $(".gcard-modal").jqm({onShow:fadeOpen,	onHide:fadeClose, overlay:0	});
	$(".gcard-modal .btnClose, .gcard-modal .cancel").click(function(){	$(".gcard-modal").jqmHide(); });
	
	$("#change-gift").click(function(){ $("#gcard-modal-1").jqmShow(); });
	$("#change-gift").dblclick(function(){ $("#gcard-modal-2").jqmShow(); });
	
    //help popup
    $("#helpModal div.helpContainer").each(function() {
        $(this).load($(this).attr("helpUrl"));
    });
});

