$(document).ready(function(){
      $(".tweet").tweet({
			username: "babyrepublic",
            join_text: "auto",
            avatar_size: 32,
            count: 1,
            auto_join_text_default: "we said,",
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "we replied to",
            auto_join_text_url: "we were checking out",
            loading_text: "loading latest tweet..."
});
});

      

$(function(){
if (typeof(global_Current_ProductCode) !="undefined")
	{
		$('td[colspan="2"]:eq(2)').find('img').remove();
		if ($('#pt493').length == 0 )
			{	
			$('#Header_ProductDetail_ProductDetails').closest('table').before($('table[width="100%"][cellspacing="0"][cellpadding="10"][border="0"]:eq(0)'));
			$('table[width="100%"][cellspacing="0"][cellpadding="10"][border="0"]:eq(0) tr td b').after('<a href="#reviews">Read Reviews</a> | ');
			$('table[width="100%"][cellspacing="0"][cellpadding="10"][border="0"]:eq(0)').find('br:first').remove();
			$('.Reviews:eq(0)').closest('table').before('<table id="reviews" width="100%" cellspacing="0" cellpadding="10"><tr><td>Customer Reviews:</td></tr></table>');
			}
		$('#pt656').parents('table:eq(1)').before($('#pt493'));
		$('#pt493').before('<br>').after('<br>');
//		$('#pt493').after('<br>');
	}
});


jQuery(function(){
if (typeof global_Current_ProductCode != 'undefined')
{
jQuery('td.smalltext[width="92%"].colors_text[width="92%"]').find('a').each(function(){
var history_photo= global_Config_StoreFolderName + global_Config_ProductPhotosFolder + '/' + jQuery(this).attr('href').substr(jQuery(this).attr('href').indexOf('=')+1).replace(/%2F/g, "-fslash-").replace("+", "%20") + '-0.gif';
jQuery(this).closest('td').prev('td').find('img').attr('src', history_photo);
jQuery(this).closest('td').prev('td').find('img').error(function() {
	$(this).attr('src').replace('.gif','.jpg');
	var old_suf= $(this).attr('src');
	var new_suf= old_suf.replace(".gif", ".jpg");
	$(this).attr('src',new_suf);
});
jQuery("img[src$='heading_history.gif']").prev('br').remove();
jQuery('td.smalltext[width="92%"].colors_text[width="92%"]').css('padding-left','10px');
});
}
});




jQuery(function(){
var rev_title;
var rev_alt;
var star_text_1= "Not Good";
var star_text_1_5= "Not Good";
var star_text_2= "Needs That Special Something";
var star_text_2_5= "Needs That Special Something";
var star_text_3= "Average, ordinary";
var star_text_3_5= "Average, ordinary";
var star_text_4 ="That's Good Stuff";
var star_text_4_5= "Perfect. It doesn't get any better";
var star_text_5="Perfect. It doesn't get any better";
//jQuery('td[width="33%"][valign="top"],td[width="50%"][valign="top"],td[width="100%"][valign="top"]').children('a.productnamecolor.colors_productname').remove();
jQuery('td[width="33%"][valign="top"],td[width="50%"][valign="top"],td[width="100%"][valign="top"]').children('a.productnamecolor.colors_productname:not(.skip)').each(function(){
var star_link = jQuery(this).attr('href');
var star_link_query_url= '/ProductComparison.asp?ProductCode1=' + star_link.substr(star_link.lastIndexOf('-p/')+3).replace(".htm", "") + '&o=1';
var rev_link='/ReviewsList.asp?ProductCode='+ star_link.substr(star_link.lastIndexOf('-p/')+3).replace(".htm", "");
jQuery.ajax({
url: star_link_query_url,
type: 'GET',
cache: false,
success: function(data){
		var rev_text;
		var rev_number = $(data).find("#pt691").text();
		if (rev_number=="1")
		{ 
		rev_text="Review";
		}
		else
		{
		rev_text="Reviews";
		}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star5.gif"') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_5+'" alt="+star_text_5+" border="0" src="/v/vspfiles/templates/bp1011/images/star5.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star4.5.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_4_5+'" alt="'+star_text_4_5+'" border="0" src="/v/vspfiles/templates/bp1011/images/star4.5.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star4.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_4+'" alt="'+star_text_4+'" border="0" src="/v/vspfiles/templates/bp1011/images/star4.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star3.5.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_3_5+'" alt="'+star_text_3_5+'" border="0" src="/v/vspfiles/templates/bp1011/images/star3.5.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star3.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_3+'" alt="'+star_text_3+'" border="0" src="/v/vspfiles/templates/bp1011/images/star3.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star2.5.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_2_5+'" alt="'+star_text_2_5+'" border="0" src="/v/vspfiles/templates/bp1011/images/star2.5.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star2.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_2+'" alt="'+star_text_2+'" border="0" src="/v/vspfiles/templates/bp1011/images/star2.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star1.5.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_1_5+'" alt="'+star_text_1_5+'" border="0" src="/v/vspfiles/templates/bp1011/images/star1.5.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star1.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_1+'" alt="'+star_text_1+'" border="0" src="/v/vspfiles/templates/bp1011/images/star1.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star0.5.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_1+'" alt="'+star_text_1+'" border="0" src="/v/vspfiles/templates/bp1011/images/star0.5.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
	if(data.indexOf('<img src="/v/vspfiles/templates/bp1011/images/star0.gif') != -1)
	{
jQuery('a[href="'+star_link+'"]:not(.smalltext, .colors_text, .productnamecolor, .colors_productname, .no_stars)').after('<br><a href="'+rev_link+'"><img width="64px" height="12px" class="star_new" title="'+star_text_1+'" alt="'+star_text_1+'" border="0" src="/v/vspfiles/templates/bp1011/images/star0.gif"></a><br><span class="review_quantity">'+rev_number+' '+rev_text+'</span>');
	}
jQuery('.star_new').css('margin-top','10px').css('margin-bottom','5px');
jQuery('.review_quantity').css('margin-bottom','5px').css('display','block');
			} //success function
	}) //ajax function
}); //each
}); //doc
