// JavaScript Document

// Beyond the Zone homepage featured promotions
// Created by Bethany Tate
// 4/9/09


function checkCookie () {
	var x = readCookie('btzPromo');

	if (x == "false") {
		setTimeout(couponPopup(), 30000);
	}
}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return "false";
}


<!----------------------- Creates BTZ promotional popup ------------------->

function couponPopup () {

var winHeight = GetHeight();
var winWidth = GetWidth();

var specHeight = winHeight / 2 - 75;
var specWidth = winWidth / 2 - 250;

if (document.all) {
document.all.promoContainer.style.pixelLeft = 0;
document.all.promoContainer.style.visibility = 'visible';
document.all.promoContainer.style.height = winHeight;

document.all.specialPromo.style.visibility = 'visible';
document.all.specialPromo.style.pixelLeft = specWidth;
document.all.specialPromo.style.pixelTop = specHeight;
}
else if (document.layers) {
document.promoContainer.left = '0px';
document.promoContainer.visibility = 'show';
document.promoContainer.height = winHeight;

document.specialPromo.visibility = 'show';
document.specialPromo.left = specWidth + 'px';
document.specialPromo.top = specHeight + 'px';
}
else if (document.getElementById) {
document.getElementById('promoContainer').style.left = '0px';
document.getElementById('promoContainer').style.visibility = 'visible';
document.getElementById('promoContainer').style.height = winHeight;

document.getElementById('specialPromo').style.visibility = 'visible';
document.getElementById('specialPromo').style.left = specWidth + 'px';
document.getElementById('specialPromo').style.top = specHeight + 'px';
   }
}


// Get width and height of page to center BTZ promo 
 function GetWidth()
      {
              var x = 0;

              if (self.innerHeight){
                      x = self.innerWidth;
              }
              else if (document.documentElement && document.documentElement.clientHeight) {
                      x = document.documentElement.clientWidth;
              }
              else if (document.body) {
                      x = document.body.clientWidth;
              }
              return x;
      }    

      function GetHeight()
      {
              var y = 0;

              if (self.innerHeight) {
                      y = self.innerHeight;
              }
              else if (document.documentElement && document.documentElement.clientHeight) {
                      y = document.documentElement.clientHeight;
              }
              else if (document.body) {
                      y = document.body.clientHeight;
              }
              return y;
      }
	  

// Create cookie, Don't show again
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	
	closePromo();
}


// Close BTZ promotional popup
function closePromo() {
if (document.all) {
document.all.promoContainer.style.visibility = 'hidden';
document.all.specialPromo.style.visibility = 'hidden';

}
else if (document.layers) {
document.promoContainer.visibility = 'hide';
document.specialPromo.visibility = 'hide';

}
else if (document.getElementById) {
document.getElementById('promoContainer').style.visibility = 'hidden';
document.getElementById('specialPromo').style.visibility = 'hidden';
   }

}


<!------------------------ Creates coupon popup window -------------------->

// This function creates the array; do not modify
function initArray() {
for (var i = 0; i < initArray.arguments.length; i++)
this[i] = initArray.arguments[i];
this.length = initArray.arguments.length;
}

// This is the array for the chrome variations. You may
// modify or add to these options. The fourth entry, "",
// is for no chrome.
var chrome = new initArray(
"menubar=no",
"menubar=no,toolbar=no",
"menubar=no,status=no,resizable=no,scrollbars=no",
"");

var popUpWin

// This function makes the pop up window. Modify the
// tall and side variables as needed.

function makePopUpWin(pic,high,wide,text,features) {
var tall = high // + 3 adjust for spacing to border above and below picture
var side = wide  // + 3 adjust for spacing to border on sides of picture
var describeIt = text
var picture = eval("pic")
var winFeatures = features
if (!popUpWin || popUpWin.closed) {
popUpWin = eval("window.open('','','"+chrome[winFeatures]+",height="+tall+",width="+side+"')")
if (!popUpWin.opener) {
popUpWin.opener = window
}

//THE NEXT LINE IS THE TITLE OF THE BOX

var popUpContent = "<html><head><title>SallyBeauty.com</title></HEAD>"
	
//THE NEXT LINE SPECIFIES THE PROPERTIES OF THE BOX ITSELF. YOU CAN CHOOSE
//TEXT TYPE, TEXT COLOUR, BODY COLOUR, TEXT SIZE ETC

popUpContent += "<body bgcolor=#FFFFFF topmargin=0 marginheight=0 leftmargin=0 marginwidth=0>" 

//THE NEXT LINE SHOULD NOT BE CHANGED IT IS JUST AN INSTRUCTION

popUpContent += "<table border=0 width=100% height=100% CELLSPACING=0 CELLPADDING=0 valign=middle ALIGN=CENTER><tr><td width=100% valign=middle align=center>" 

//THE NEXT LINE SHOULD NOT BE CHANGED IT IS JUST AN INSTRUCTION

popUpContent += "<img src="+picture+"><BR><div style='font: 12px Arial,Helvetica,sans-serif;'><A HREF='javascript:window.print()'>Print Coupon</A> | <A HREF='javascript:window.close()'>Close Window</A></div><p style='font: 12px Arial,Helvetica,sans-serif; tex-align: center;'>This coupon is applicable online exclusively at <a href='http://www.sallybeauty.com/styling-products/Hair04,default,sc.html?q=Beyond+the+Zone&start=0&sz=48' target='_blank'>SallyBeauty.com</a>.<br />Use promo code <span style='color: #dc4357; font-weight: bold;'>555222</span> when purchasing online.</p></td></tr></table></body></html>" 



//DO NOT MAKE ANY CHANGES TO THE LINES BELOW

popUpWin.document.write(popUpContent) // writes the window content
popUpWin.document.close() // closes the output stream
} else {
popUpWin.focus()
}
}

// This function closes the pop up window.
function closePopUpWin() {
if (popUpWin && !popUpWin.closed)
popUpWin.close();
}
// -->
//-->