<!--
var winW = 630;
if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
 }
}
var http;
var showAlert = true;
function createRequestObject() {
    if (navigator.appName == 'Microsoft Internet Explorer') {
        try {
            http = new ActiveXObject('Msxml2.XMLHTTP'); 
        }
        catch(e) {
            http = new ActiveXObject('Microsoft.XMLHTTP');
        }
    }
    else {
        http = new XMLHttpRequest();
    }
}
createRequestObject();
function addCoupon() {
		http.open('GET',window.parent.document.location.protocol + '//'+window.parent.document.location.host+'/shop/add.php?coupon=4PO&mode=add_coupon',true);
		http.onreadystatechange = function()  {
			if(http.readyState == 4) {
				if(http.responseText == 'FOUND COUPON') {
					//alert('You cannot add the same offer twice!  The 4% discount has already been applied to your cart, feel free to add the products you would like to purchase and the discount will be automatically applied.');
				} else if(http.status == '200') {
					if (showAlert) {
						showAlert = false;
						//alert('Welcome Back! Take advantage of this one time, return visitors special today. We will apply a 4% discount to your purchase. Remember, this discount is only good for this visit! Thanks for shopping with us!');
						//close3rdVisitPromo();
						show3rdVisitPromo();
					}
				}
			}
		}
		http.send(null);
}
function addWarranty() {
		http.open('GET',window.parent.document.location.protocol + '//'+window.parent.document.location.host+'/shop/add.php?mode=add&productid=16401&amount=1',true);
		http.onreadystatechange = function()  {
			if(http.readyState == 4) {
				if(http.responseText == "FOUND WARRANTY")
					alert('You cannot add the same offer twice!  The extended warranty has already been applied to your cart, feel free to add the products you would like to purchase and the warranty will be automatically applied.');
				else if(http.responseText == "FOUND COUPON")
					alert('You can only use ONE of the promotions and you have already selected to use the 4% discount.');
				else if(http.status == "200") {
					alert('We have applied the extra year of warranty to your cart.  Shop around our site and add the products to your cart that you wish to purchase.  The extended warranty will automatically be applied to your order.  Remember, this offer is only good for this visit! Thank you!');
					close3rdVisitPromo();
				}
			}
		}
		http.send(null);
}
function close3rdVisitPromo() {
	http.open('GET',window.parent.document.location.protocol + '//'+window.parent.document.location.host+'/includes/3rdvisitpromo_donotdisplay.php',false);
	http.send(null);
	
	$('#thirdvisitpromo').hide();
}
function hide3rdVisitPromo () {
/*	$('#thirdvisitpromo').animate({
		top: $('#thirdvisitsmall').height() - $('#thirdvisitpromo').height()
	}, 700, 0, function() {
		$('#thirdvisitsmall').show();
		$('#thirdvisitpromo').hide();
		$.cookie("3rdpromostate", "up");
	});
*/
}
function show3rdVisitPromo () {
	var newPos = $('#body-container').offset().left + ($('#body-container').width() / 2) - ($('#thirdvisitpromo').width() / 2);
	$('#thirdvisitpromo').css("left", newPos);
	$("#thirdvisitpromo").css("top", -200);
	$("#thirdvisitpromo").css("visibility", "visible");	
	$('#thirdvisitpromo').show();
	$('#thirdvisitpromo').animate({
		top: 5,
		opacity: 1
	}, 700, 0);
}

$(document).ready(function() {
	addCoupon();
/*	var state = $.cookie("3rdpromostate");
	if (state == null || state == undefined) {
		$('#thirdvisitpromo').css('top', -$('#thirdvisitpromo').height());
		$('#thirdvisitpromo').css('opacity', 0);
		$('#thirdvisitpromo').show();
		$('#thirdvisitpromo').animate({
			top: 33,
			opacity: 1
		}, 1000, 0, function() {
			$.cookie("3rdpromostate", "init");
		});
	} else {
		$('#thirdvisitpromo').css("opacity", 1);
		switch (state) {
			case "up":
				$('#thirdvisitpromo').hide();
				$('#thirdvisitsmall').show();
				$('#thirdvisitpromo').css("top", $('#thirdvisitsmall').height() - $('#thirdvisitpromo').height());
				break;
			case "down":
				$('#thirdvisitpromo').show();
				$('#thirdvisitsmall').hide();
				$('#thirdvisitpromo').css("top", 0);
				break;
			case "init":
			default:
				$('#thirdvisitpromo').show();
				$('#thirdvisitsmall').hide();
				$('#thirdvisitpromo').css("top", 33);				
				break;
		}
	}
*/
});
-->

