function render_home_sifr(){
	$('#promo_paper_head').sifr({
		font:'kimshand_capi',
		path:'/content/fonts',
		content:'Reduce transportation cost'
	});
	$('#promo_list LI').sifr({
		font:'kimshand_capi',
		path:'/content/fonts',
		underline:true,
		hover:'#606b2d',
		color:'#000'
	});
	$('.promo_blurb H1').sifr({
		font:'segoeuii_v2',
		path:'/content/fonts'
	});
	$('.box_bottom H2').sifr({
		font:'segoeuii_v2',
		path:'/content/fonts'
	});
	$('.txt_foot_tag').sifr({
		font:'segoeuii_v2',
		path:'/content/fonts'
	});
}

function render_product_sifr(){
	$('.promo_blurb H2').sifr({
		font:'segoeuii_v2',
		path:'/content/fonts'
	});
	//skip rendering if opera
	if(!window.opera) {
		$('.promo_blurb P').sifr({
			font:'segoeuii_v2',
			path:'/content/fonts',
			width:250
		});	
	}
	$('.title').sifr({
		font:'segoeuii_v2',
		path:'/content/fonts'
	});	
	$('.subtitle').sifr({
		font:'segoeuii_v2',
		path:'/content/fonts'
	});	
}

function cycle_home_promos(){
	$('#promo_l2_inner').cycle({ 
    fx:     'scrollLeft', 
    speed:   1000, 
    timeout: 11000, 
    next:   '#promo_l2', 
    pause:   1,
    pager: '#promo_r',
    pagerAnchorBuilder: function(idx, slide) { 
        return '#promo_r li:eq(' + idx + ') a'; 
	  }
});
}

function cycle_product_promos(){
	$('#promo_products_inner').cycle({ 
    fx:     'scrollLeft', 
    speed:   1000, 
    timeout: 5000,
    pager: '#promo_nav',
    pagerAnchorBuilder: function(idx, slide) { 
        return '#promo_nav li:eq(' + idx + ') a'; 
	  }
});
}
function pause_product_promos(){
	$('#promo_products_inner').cycle('pause');
	$('#btn_pause').hide();
	$('#btn_play').show();
}
function resume_product_promos(){
	$('#promo_products_inner').cycle('resume');
	$('#btn_play').hide();
	$('#btn_pause').show();
}

function close_popup_window() {
	$('#send_popup_background').hide();
	$('#send_popup_wrapper').hide();	
}
function open_popup_window() {
	$('#send_popup_background').show();
	$('#send_popup_wrapper').show();	
}

function send_page() {
	$('#send_page_form').submit();
}

$(document).ready(function(){
	//skip rendering if ie6
	if(!/MSIE 6/i.test(navigator.userAgent)) {
		render_home_sifr();
		render_product_sifr();
	}
	cycle_home_promos();
	cycle_product_promos();
});
//-- form functions
function CompleteSTF() {
    $('#send_popup').unblock();
}
function SuccessSTF() {
    close_popup_window();
}
function FailureSTF() {
    close_popup_window();
}
function ValidateSTF() {
    var r = $("#send_page_form").validate({
        rules: {
            FromEmail: { required: true, email: true },
            ToEmail: { required: true, email: true }

        },
        messages: {
            FromEmail: "",
            ToEmail: ""

        }
    }).form();
    if (r)
        BlockMeSTF();

    return r;

}
function BlockMeSTF() {
    $('#send_popup').block({ css: {
        border: 'none',
        padding: '15px',
        backgroundColor: '#000',
        '-webkit-border-radius': '10px',
        '-moz-border-radius': '10px',
        opacity: '.5',
        color: '#fff'
    }
    });
}
