//site static elements header and footer (Facebook)
var facebookHeader = '<div id="facebook-header"><img src="/lib/suspenderstore/fb-header-bg.png">	<a href="http://order.store.yahoo.net/suspenderstore/cgi-bin/wg-order?suspenderstore"><img src="/lib/suspenderstore/vwd-view-cart.png" id="header-view-cart"></a>	<div id="site-logo"><a title="suspenderstore.com" href="facebook.html"><img width="400" border="0" height="60" src="http://ep.yimg.com/ca/Img/trans_1x1.gif"></a>	</div><div id="fb-nav"><a href="mens-casual.html" alt="men\'s casual" title="men\'s casual">Men\'s Casual</a> | <a href="upscale.html" alt="men\'s upscale" title="men\'s upscale">Men\'s Upscale</a> | <a href="retasu.html" alt="big & tall" title="big & tall">Big & Tall</a> | <a href="leather-suspenders.html" alt="leather" title="leather">Leather</a> | <a href="novelty-sections.html" alt="novelty" title="novelty">Novelty</a> | <a href="womens-suspenders.html" alt="women" title="women">Women</a> | <a href="kidssuspenders.html" alt="kids" title="kids">Kids</a> | <a href="new-items.html" alt="new" title="new">New</a> | <a href="salesuspenders.html" alt="SALE" title="SALE">SALE</a></div></div>';

var facebookFooter = '<div id=\"facebook-footer-wrapper\">  <div id=\"footer-links\">		<div>			<span>HOW CAN WE HELP?</span><br>			<a alt=\"Contact Us\" href=\"contact-us.html\">Contact Us</a><br>			<a alt=\"Shipping\" href=\"shippinginfo.html\">Shipping</a><br>			<a alt=\"Returns &amp; Exchanges\" href=\"returnpolicy.html\">Returns &amp; Exchanges</a><br>			<a alt=\"FAQs\" href=\"faqs.html\">FAQs</a><br>			<a alt=\"Special Orders\" href=\"specialorders.html\">Special Orders</a>		</div>		<div>			<span>MORE WAYS TO SHOP</span><br>			<a alt=\"Gift Certificates\" href=\"fcoce.html\">Gift Certificates</a><br>			<a alt=\"Request a Catalog\" href=\"join-mailing-list.html\">Request a Catalog</a><br>			<a alt=\"Sign Up for Promotions\" href=\"promotions.html\">Sign Up for Promotions</a>		</div>		<div style=\"border-right: 0 !important\">			<span>ABOUT US</span><br>			<a alt=\"Our Story\" href=\"info.html\">Our Story</a><br>			<a alt=\"Testimonials\" href=\"testimonials.html\">Testimonials</a><br>			<a alt=\"In The News\" href=\"in-the-news.html\">In The News</a><br>			<a alt=\"Links We Like\" href=\"links-we-like.html\">Links We Like</a><br>			<a alt=\"Site Map\" href=\"ind.html\">Site Map</a>			<a alt=\"Security/Privacy\" href=\"privacypolicy.html\">Security/Privacy</a><br>		</div>		</div>	<img src=\"/lib/suspenderstore/footer-sep.png\" id=\"footer-sep\"> <br><br><span id=\"copyright\">Copyright &copy; SuspenderStore.com All Rights Reserved. Website Design by <a href=\"http://www.venturawebdesign.com/\">Yahoo! Store Designer</a> <a href=\"http://www.venturawebdesign.com/\">Ventura Web Design</a><br>	</span><br><img src=\"/lib/suspenderstore/cc-paypal.jpg\" alt=\"Forms of Payment Accepted\" /> </div>';

var fbtop = '<div id="fb-root"></div>';

$(document).ready(function() {
	if(window != top){
	
		// Adding facebook element to the page (when in facebook environment). 
		// Function came from Facebook's "Load the SDK Asynchronously"
		(function(s){
			var st;
			st = s.createElement('link'); st.async = true;
			st.href = "https://lib.store.yahoo.net/lib/suspenderstore/fb-edits-cart.css";
			st.rel ="stylesheet"; st.type="text/css";
			s.getElementsByTagName('head')[0].appendChild(st);
		}(document));	
		
		//add Facebook friendly header to the page
		$('body').prepend(fbtop);
		$('#fb-wrapper').append(facebookHeader);
		$('#fb-wrapper').append(facebookFooter);
		
		$('#wrapper').addClass('fb-wrapper');
		$('#wrapper #header-table').addClass('fb-header').html(facebookHeader);
		$('#ys_merchHeader #header').addClass('fb-header').html(facebookHeader);
		$('#footer').addClass('fb-footer').html(facebookFooter);
		
		//this moves the buy box below the images
		var temp = $('#itemarea > table > tbody > tr > td:nth-child(2)').clone();
		$('#itemarea > table > tbody > tr > td:nth-child(2)').remove();
		$('#itemarea').append(temp);
		
		//this removes the ability to enlarge the images on the item pages
		$('.vwd-enlarge').attr('href','#');
		$('.vwd-enlarge').attr('rel','');
		//$('.vwd-enlarge').removeClass('vwd-enlarge');
		$('.cboxElement').removeClass('cboxElement');
		
		//this puts the cross sell in a manageable area
		var tempA = $('#item-cross-sell > #item-cross-sell-wrapper > #contents-table').clone();
		$('#item-cross-sell').remove();
		$('#contentarea').append(tempA);
				
		//provided SDK sync with Facebook
		window.fbAsyncInit = function() {
			FB.init({
			  appId      : '250973271642766', // App ID
				//channelUrl : '//www.suspenderstore.com/channel.html', // Channel File
			  status     : true, // check login status
			  cookie     : true, // enable cookies to allow the server to access the session
			  xfbml      : true  // parse XFBML
			});    
			// Additional initialization code here
			FB.Canvas.setAutoGrow();
			FB.Canvas.setSize();
			FB.Canvas.scrollTo(0,0);			
		};
	/*
		// Load the SDK Asynchronously
		(function(d){
		 var js, id = 'facebook-jssdk'; 
		 if (d.getElementById(id)) {return;}
		 js = d.createElement('script'); 
		 js.id = id; 
		 js.async = true;
		 js.src = "//connect.facebook.net/en_US/all.js";
		 d.getElementsByTagName('head')[0].appendChild(js);
		}(document));
	*/
	}
});


