<!--

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   //MM_swapImage('imageName','','image/address',1);
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function centerLayout(){
	var layoutWidth = 760;
	
	if (document.getElementById && navigator.appName == 'Netscape'){
		var bodyWidth = self.innerWidth;
		if(bodyWidth >= layoutWidth){
			document.getElementById('centerlayer').style.left = "50%";
			document.getElementById('centerlayer').style.marginLeft = "-380px";
		}else{
			document.getElementById('centerlayer').style.left = "0px";
			document.getElementById('centerlayer').style.marginLeft = "0px";
		}
		
	}else if (document.getElementById){
		var bodyWidth = document.body.offsetWidth; 
		
		if(bodyWidth >= layoutWidth - 10){
			document.getElementById('centerlayer').style.left = "50%";
			document.getElementById('centerlayer').style.marginLeft = "-380px";
		}else{
			document.getElementById('centerlayer').style.left = "0px";
			document.getElementById('centerlayer').style.marginLeft = "0px";
		}
		
	}else if (document.layers){
			document.layers['centerlayer'].left = 0;
			document.layers['centerlayer'].marginLeft = 0;
			
    }else if (document.all){
		var bodyWidth = self.innerWidth;
		if (bodyWidth >= layoutWidth){
			document.all.tags('div')['centerlayer'].style.left = "50%";
			document.all.tags('div')['centerlayer'].style.marginLeft = "-380px";
		}else{
			document.all.tags('div')['centerlayer'].style.left = "0px";
			document.all.tags('div')['centerlayer'].style.marginLeft = "0px";
		}
	}
}

function showHideContent(id)
{
	var elem = document.getElementById(id);
	var img = document.images['img' + id];

	var rExp = "";
	var replace = "";

	if (elem) 
	{
		if (elem.style.visibility == 'hidden') 
		{
			elem.style.display = 'block';
			elem.style.visibility = 'visible';
			rExp = /up/gi;
			replace = "down";
		} 
		else
		{
			elem.style.display = 'none';
			elem.style.visibility = 'hidden';
			rExp = /down/gi;
			replace = "up";
		}
	}

    if (img)
	{
		imgSrc = new String(img.src);
		var newPath = imgSrc.replace(rExp,replace);
		img.src = newPath;
	}
}
   
function showTips(id1,id2)
{
	var elem1 = document.getElementById(id1);
	var elem2 = document.getElementById(id2);
	
	 if (elem1 && elem2) 
    {
        elem1.style.display = 'none';
        elem1.style.visibility = 'hidden';
        elem2.style.display = '';
        elem2.style.visibility = 'visible';
    } 
} 

function GetLink(list) {

	if (list.selectedIndex > 0) {
		var win = window.open("http://www.sbshopnow.com/templates/sbexit.asp?mr=" + (list.selectedIndex) + "&ct=LIST&sbid=" + list.options[list.selectedIndex].value,"win");
		win.focus();
	}
}

function JumpLink(link) {

	var win = window.open(link,"win");
    win.focus();
}
  
function puzzleLeft() {

	window.location = 'Quit_Place_Customize.aspx';

}

function puzzleRight() {

	var win = window.open("http://committedquitters.quit.com/", "cqp");

}

function puzzleMiddle() {
	
	window.location = 'NicodermCQ.aspx';
	
}

function clickHerePuzzle() {

	window.location = 'Quit_NicodermCQ.aspx';

}

//Dropdown functions
function showMenu(elem) {
	document.getElementById(elem).style.visibility = "visible"
}

function hideMenu(elem) {
	document.getElementById(elem).style.visibility = "hidden"
}

function new_windowRapids() 
{
	self.name = "Parent_Window"; 
	var new_window = "toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,resizable=no,width=500,height=500";
	OpenWindow = window.open("Games_ContainerRapids.aspx", "remote", new_window);
}

function new_windowStairs() 
{
	self.name = "Parent_Window"; 
	var new_window = "toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,resizable=no,width=500,height=500";
	OpenWindow = window.open("Games_ContainerBoss.aspx", "remote", new_window);
}

function new_windowWire() 
{
	self.name = "Parent_Window"; 
	var new_window = "toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,resizable=no,width=500,height=500";
	OpenWindow = window.open("Games_ContainerWire.aspx", "remote", new_window);
}

function doClose()
{
	window.close();
}

function SP00()
{
	window.opener.location="Quit_Place.aspx";
	//self.close();
}

function WQ02()
{
	window.opener.location="NicodermCQ_Stories.aspx";
	//self.close();
}

function CQ02A()
{
	window.opener.location="Quit_Place_Cravings.aspx";
	//self.close();
}

function CQ02Aii()
{
	window.opener.location="NicodermCQ.aspx";
	//self.close();
}

function ST01()
{
	window.opener.location="Quit_Place_Trigger.aspx";
	//self.close();
}

function ST03()
{
	window.opener.location="Quit_Place_Cravings.aspx";
	//self.close();
}

function See_How_It_Works()
{
	window.open('PopUp.aspx?cmsId=fe5a0db5-49ee-4fda-a1b0-65b8377c32b8','popup','scrollbar=auto,resize=true,width=520,height=620');
	//window.location="NicodermCQ_How.aspx";
	//self.close();
}

function discussionBoardPop()
{
	//window.open('DiscussionBoard/NicodermDiscussionBoard.promo','db','scrollbars=yes,resizable=yes,width=820,height=620');
	window.open('DiscussionBoard/NicodermDiscussionBoard.promo');
	
	return false;
}

//			DO NOT REMOVE WAITING 4 APPROVAL

//Smoking Control Cross Brand ExitSurvey_Q2_2008
function exitSurveyPop()
{
	var timeIn = getCookie('gskW2QExitCookie');
	var limit = 1*60*1000 + Date.parse(timeIn);
	var nowTime = new Date();
	var popped = readCookie('gskW2QExitCookiePopped');
	
	if(limit < nowTime.getTime() && popped != "true")
		popSurvey();
}

function popSurvey()
{
	var subDir = getURL() + "W2QExitSurvey.aspx";
	var newWin = window.open(subDir,'_blank','scrollbars=yes,resizable=yes, width=780, height=620');
	
	//if it hasnt create gskW2QExitCookiePopped
	document.cookie = 'gskW2QExitCookiePopped=true; expires=Thu, 2 Aug 2010 20:47:11 UTC; path=/' 
	
	//determines whether the pop up is blocked
	if(!(newWin && newWin.top))
	{	
		//then delete original cookie
		delCookie();
	}
}

function getURL(){
  var strReturn = "";
  var strHref = window.location.href;
  var strArray = strHref.split("/");
  var i;
  
  if(strArray[2].toLowerCase() == "localhost")
	i = 5;
  else
	i = 4;
  
  while(i<strArray.length)
  {
	strReturn += "../";
	i++;
  }

  return strReturn;
} 

function popped()
{
	var popped = getCookie('gskW2QExitCookiePopped');
	
	if(popped == null || popped == "")
		return false;
	else
		return true;
}

//returns a date and time when the cookie was created
//returns the current date and time if it is a new cookie
function getCookie(cookieName)
{
	var cookie = document.cookie;
	var prefix = cookieName + "=";
	var begin = cookie.indexOf("; " + prefix);
	
	if(begin == -1)
	{
		begin = cookie.indexOf(prefix);
		
		if(begin != 0)
			return new Date();
		else
		{
			var foundCookie = cookie.substring(begin,cookie.length);
			var timeIn = "=TimeIn=";
			var beginTime = foundCookie.indexOf(timeIn);
			var end = foundCookie.indexOf(";",beginTime);
			if(end == -1)
				end = document.cookie.length;
			return (foundCookie.substring(beginTime + 8,end));			
		}
	}
	else
	{
		var foundCookie = cookie.substring(begin,cookie.length);
		var timeIn = "=TimeIn=";
		var beginTime = foundCookie.indexOf(timeIn);
		end = foundCookie.indexOf(";",beginTime);
		if(end == -1)
			end = document.cookie.length;
		return (foundCookie.substring(beginTime + 8,end));
	}
}

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 null;
}

//sets the expiration date of the cookie so it can be erased
function delCookie()
{
	var d = new Date();
	document.cookie = "gskW2QExitSurvey;expires=Thu, 01-Jan-70 00:00:01 GMT;";	
}

//checks the cookie
//setInterval ( "exitSurveyPop()", 5000 );

// End of Smoking Control Cross Brand ExitSurvey_Q2_2008
//-->

/*  FLASH NAV */
function openQuitRewards() /* Added for SoftCoin_ReContact project */
{
	window.open('softcoin/default.aspx','SoftCoin','height=613,width=785,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}

function openePrize()
{
	window.open('21daystrong/Default.aspx','21daystrong','height=760,width=800,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}

//used by the NicoDerm CQ Home Page flash FREE SAMPLE OFFER TAB
//function getMyPage(){
//	window.open('http://www.startsampling.com/sm/100599/?source=nicoderm','SevenDollarCOuponSample','height=760,width=1000,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
//}

//used by the NicoDerm CQ Home Page flash FREE SAMPLE OFFER TAB
function SevenDollarCouponFreeSample(){
	window.open('http://www.startsampling.com/sm/100599/?source=nicoderm','SevenDollarCOuponSample','height=760,width=1000,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes');
}