var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{
			string: navigator.userAgent,
			subString: "Chrome",
			identity: "Chrome"
		},
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari",
			versionSearch: "Version"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Microsoft Internet Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.userAgent,
			subString: "Windows NT 6.1",
			identity: "Windows 7"
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 6.0",
			identity: "Windows Vista"
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 5.2",
			identity: "Windows XP x64 Edition"
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 5.1",
			identity: "Windows XP"
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 5.01",
			identity: "Windows 2000, Service Pack 1 (SP1)"
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 5.0",
			identity: "Windows 2000"
		},
		{
			string: navigator.userAgent,
			subString: "Windows NT 4.0",
			identity: "Microsoft Windows NT 4.0"
		},
		{
			string: navigator.userAgent,
			subString: "Windows 98; Win 9x 4.90",
			identity: "Windows Millennium Edition (Windows Me)"
		},
		{
			string: navigator.userAgent,
			subString: "Windows 98",
			identity: "Windows 98"
		},
		{
			string: navigator.userAgent,
			subString: "Windows 95",
			identity: "Windows 95"
		},
		{
			string: navigator.userAgent,
			subString: "Windows CE",
			identity: "Windows CE"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
/**
* @constructor
*/

DHTML_modalMessage = function()
{
	var url;								// url of modal message
	var htmlOfModalMessage;					// html of modal message
	
	var divs_transparentDiv;				// Transparent div covering page content
	var divs_content;						// Modal message div.
	var iframe;								// Iframe used in ie
	var layoutCss;							// Name of css file;
	var width;								// Width of message box
	var height;								// Height of message box
	
	var existingBodyOverFlowStyle;			// Existing body overflow css
	var dynContentObj;						// Reference to dynamic content object
	var cssClassOfMessageBox;				// Alternative css class of message box - in case you want a different appearance on one of them
	var shadowDivVisible;					// Shadow div visible ? 
	var shadowOffset; 						// X and Y offset of shadow(pixels from content box)
	var MSIE;
	
	
var gTabIndexes = new Array();
// Pre-defined list of tags we want to disable/enable tabbing into
var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");		
	this.url = '';							// Default url is blank
	this.htmlOfModalMessage = '';			// Default message is blank
	this.layoutCss = 'modal-message.css';	// Default CSS file
	this.height = 200;						// Default height of modal message
	this.width = 400;						// Default width of modal message
	this.cssClassOfMessageBox = false;		// Default alternative css class for the message box
	this.shadowDivVisible = true;			// Shadow div is visible by default
	this.shadowOffset = 5;					// Default shadow offset.
	this.MSIE = false;
	if(navigator.userAgent.indexOf('MSIE')>=0) this.MSIE = true;
	

}

DHTML_modalMessage.prototype = {
	// {{{ setSource(urlOfSource)
    /**
     *	Set source of the modal dialog box
     * 	
     *
     * @public	
     */		
	setSource : function(urlOfSource)
	{
		this.url = urlOfSource;
		
	}	
	// }}}	
	,
	// {{{ setHtmlContent(newHtmlContent)
    /**
     *	Setting static HTML content for the modal dialog box.
     * 	
     *	@param String newHtmlContent = Static HTML content of box
     *
     * @public	
     */		
	setHtmlContent : function(newHtmlContent)
	{
		this.htmlOfModalMessage = newHtmlContent;
		
	}
	// }}}		
	,
	// {{{ setSize(width,height)
    /**
     *	Set the size of the modal dialog box
     * 	
     *	@param int width = width of box
     *	@param int height = height of box
     *
     * @public	
     */		
	setSize : function(width,height)
	{
		if(width)this.width = width;
		if(height)this.height = height;		
	}
	// }}}		
	,		
	// {{{ setCssClassMessageBox(newCssClass)
    /**
     *	Assign the message box to a new css class.(in case you wants a different appearance on one of them)
     * 	
     *	@param String newCssClass = Name of new css class (Pass false if you want to change back to default)
     *
     * @public	
     */		
	setCssClassMessageBox : function(newCssClass)
	{
		this.cssClassOfMessageBox = newCssClass;
		if(this.divs_content){
			if(this.cssClassOfMessageBox)
				this.divs_content.className=this.cssClassOfMessageBox;
			else
				this.divs_content.className='modalDialog_contentDiv';	
		}
					
	}
	// }}}		
	,	
	// {{{ setShadowOffset(newShadowOffset)
    /**
     *	Specify the size of shadow
     * 	
     *	@param Int newShadowOffset = Offset of shadow div(in pixels from message box - x and y)
     *
     * @public	
     */		
	setShadowOffset : function(newShadowOffset)
	{
		this.shadowOffset = newShadowOffset
					
	}
	// }}}		
	,	
	// {{{ display()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	display : function()
	{
		if(!this.divs_transparentDiv){
			this.__createDivs();
		}	
		
		// Redisplaying divs
		this.divs_transparentDiv.style.display='block';
		this.divs_content.style.display='block';
		this.divs_shadow.style.display='block';		
		if(this.MSIE)this.iframe.style.display='block';	
		this.__resizeDivs();
		
		/* Call the __resizeDivs method twice in case the css file has changed. The first execution of this method may not catch these changes */
		window.refToThisModalBoxObj = this;		
		setTimeout('window.refToThisModalBoxObj.__resizeDivs()',150);
		
		this.__insertContent();	// Calling method which inserts content into the message div.
		OnClientShow(); //Calling this Method To Disable Across all Browsers
	}
	// }}}		
	,
	// {{{ ()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	setShadowDivVisible : function(visible)
	{
		this.shadowDivVisible = visible;
	}
	// }}}	
	,
	// {{{ close()
    /**
     *	Close the modal dialog box
     * 	
     *
     * @public	
     */		
	close : function()
	{
		//document.documentElement.style.overflow = '';	// Setting the CSS overflow attribute of the <html> tag back to default.
		
		/* Hiding divs */
		this.divs_transparentDiv.style.display='none';
		this.divs_content.style.display='none';
		this.divs_shadow.style.display='none';
		if(this.MSIE)this.iframe.style.display='none';
		
	}	
	// }}}	
	,
	// {{{ __addEvent()
    /**
     *	Add event
     * 	
     *
     * @private	
     */		
	addEvent : function(whichObject,eventType,functionName,suffix)
	{ 
	  if(!suffix)suffix = '';
	  if(whichObject.attachEvent){ 
	    whichObject['e'+eventType+functionName+suffix] = functionName; 
	    whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} 
	    whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
	  } else 
	    whichObject.addEventListener(eventType,functionName,false); 	    
	} 
	// }}}	
	,
	// {{{ __createDivs()
    /**
     *	Create the divs for the modal dialog box
     * 	
     *
     * @private	
     */		
	__createDivs : function()
	{
		// Creating transparent div
		this.divs_transparentDiv = document.createElement('DIV');
		this.divs_transparentDiv.className='modalDialog_transparentDivs';
		this.divs_transparentDiv.style.left = '0px';
		this.divs_transparentDiv.style.top = '0px';
		
		document.body.appendChild(this.divs_transparentDiv);
		// Creating content div
		this.divs_content = document.createElement('DIV');
		this.divs_content.className = 'modalDialog_contentDiv';
		this.divs_content.id = 'DHTMLSuite_modalBox_contentDiv';
		this.divs_content.style.zIndex = 100000;
		
		if(this.MSIE){
			this.iframe = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			this.iframe.style.zIndex = 90000;
			this.iframe.style.position = 'absolute';
			document.body.appendChild(this.iframe);	
			hideSelectBoxes();
			disableTabIndexes();
			
		}
			
		document.body.appendChild(this.divs_content);
		// Creating shadow div
		this.divs_shadow = document.createElement('DIV');
		this.divs_shadow.className = 'modalDialog_contentDiv_shadow';
		this.divs_shadow.style.zIndex = 95000;
		document.body.appendChild(this.divs_shadow);
		window.refToModMessage = this;
		this.addEvent(window,'scroll',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		this.addEvent(window,'resize',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		

	}
	// }}}
	,
	// {{{ __getBrowserSize()
    /**
     *	Get browser size
     * 	
     *
     * @private	
     */		
	__getBrowserSize : function()
	{
    	var bodyWidth = document.documentElement.clientWidth;
    	var bodyHeight = document.documentElement.clientHeight;
    	
		var bodyWidth, bodyHeight; 
		if (self.innerHeight){ // all except Explorer 
		 
		   bodyWidth = self.innerWidth; 
		   bodyHeight = self.innerHeight; 
		}  else if (document.documentElement && document.documentElement.clientHeight) {
		   // Explorer 6 Strict Mode 		 
		   bodyWidth = document.documentElement.clientWidth; 
		   bodyHeight = document.documentElement.clientHeight; 
		} else if (document.body) {// other Explorers 		 
		   bodyWidth = document.body.clientWidth; 
		   bodyHeight = document.body.clientHeight; 
		} 
		return [bodyWidth,bodyHeight];		
		
	}
	// }}}	
	,
	// {{{ __resizeDivs()
    /**
     *	Resize the message divs
     * 	
     *
     * @private	
     */	
    __resizeDivs : function()
    {
    	
    	var topOffset = Math.max(document.body.scrollTop,document.documentElement.scrollTop);

		if(this.cssClassOfMessageBox)
			this.divs_content.className=this.cssClassOfMessageBox;
		else
			this.divs_content.className='modalDialog_contentDiv';	
			    	
    	if(!this.divs_transparentDiv)return;
    	
    	// Preserve scroll position
    	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    	var sl = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
    	
    	window.scrollTo(sl,st);
    	setTimeout('window.scrollTo(' + sl + ',' + st + ');',10);

    	this.__repositionTransparentDiv();
    	

		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	
    	// Setting width and height of content div
      	this.divs_content.style.width = this.width + 'px';
    	this.divs_content.style.height= this.height + 'px';  	
    	
    	// Creating temporary width variables since the actual width of the content div could be larger than this.width and this.height(i.e. padding and border)
    	var tmpWidth = this.divs_content.offsetWidth;	
    	var tmpHeight = this.divs_content.offsetHeight;
    	
    	
    	// Setting width and height of left transparent div
    	
    	

    	
    	
		
    	this.divs_content.style.left = Math.ceil((bodyWidth - tmpWidth) / 2) + 'px';;
    	this.divs_content.style.top = (Math.ceil((bodyHeight - tmpHeight) / 2) +  topOffset) + 'px';
    	
 		if(this.MSIE){
 			this.iframe.style.left = this.divs_content.style.left;
 			this.iframe.style.top = this.divs_content.style.top;
 			this.iframe.style.width = this.divs_content.style.width;
 			this.iframe.style.height = this.divs_content.style.height;
 		}
 		
    	this.divs_shadow.style.left = (this.divs_content.style.left.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.top = (this.divs_content.style.top.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.height = tmpHeight + 'px';
    	this.divs_shadow.style.width = tmpWidth + 'px';
    	
    	
    	
    	if(!this.shadowDivVisible)this.divs_shadow.style.display='none';	// Hiding shadow if it has been disabled
    	
    	
    }
    // }}}	
    ,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	    
    __repositionTransparentDiv : function()
    
	    {
		    this.divs_transparentDiv.style.top = Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
		    this.divs_transparentDiv.style.left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft) + 'px';
			var brSize = this.__getBrowserSize();
			var bodyWidth = brSize[0];
			var bodyHeight = brSize[1];
	    	this.divs_transparentDiv.style.width = bodyWidth + 'px';
	    	this.divs_transparentDiv.style.height = bodyHeight + 'px';		
			   	
	    }
	// }}}	
	,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	
    __insertContent : function()
    {
		if(this.url){	// url specified - load content dynamically
			ajax_loadContent('DHTMLSuite_modalBox_contentDiv',this.url);
		}else{	// no url set, put static content inside the message box
			this.divs_content.innerHTML = this.htmlOfModalMessage;	
		}
    }		
}

//Zip Static Code Prompt 
function displayStaticMessage(messageContent,cssClass)
{
	messageObj.setHtmlContent(messageContent);
	messageObj.setSize(300,150);
	messageObj.setCssClassMessageBox(cssClass);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(true);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayStaticMessageLocale(messageContent,cssClass)
{
	messageObj.setHtmlContent(messageContent);
	messageObj.setSize(430,150);
	messageObj.setCssClassMessageBox(cssClass);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(true);	// Disable shadow for these boxes	
	messageObj.display();
}
function closeMessage()
{
	if(document.getElementById('localeId').value != 1) {
		document.getElementById('zip-Code').value = 0;
		document.getElementById('zipCode').value = document.getElementById('zipCode_pr').value;	
	}
	document.getElementById('promptClicked').value='Y';
	document.getElementById('validation').value='';
	displaySelectBoxes();
	restoreTabIndexes();
	OnClientClose();
	messageObj.close();	
	barAppearence();
}
function barAppearence()
{
if(document.getElementById('zipCodeBarDisplay').value=='none'){
	document.getElementById('ziprow').style.display='none';	
	}
if(document.getElementById('savingsSummaryBarDisplay').value=='none'){
	document.getElementById('savingsrow').style.display='none';
	}
}
function zipFn(zipPrmpt) {
	document.getElementById('zipPrompt').checked=true;
}
//Html Content For the Modal Dialog
function staticcontent()
{
//alert(document.getElementById('localeId').value);
//document.getElementById('localeId').value='2';
	var states = document.getElementById('states').value;
	var stateList = states.split('|');
	var stateStr="";
	for(var i=0;i<stateList.length;i++){
		var stateDetList = stateList[i].split(':');
		stateStr = stateStr + '<option value="'+stateDetList[0]+'">'+stateDetList[1]+'</option>';
		
	}
	if(document.getElementById('localeId').value != 1) {
		document.getElementById('zip-Code').value = document.getElementById('zipCode').value;
	}
	if(document.couponForm && document.getElementById('prompt_check').value!='Y'&& document.getElementById('promptClicked').value!='Y' && document.getElementById('zipProptFlag').value =='Y' && document.getElementById('zipCodeBarDisplay').value==''){	
	if(document.getElementById('zip-Code').value==''||document.getElementById('zip-Code').value==null ||  document.getElementById('zip-Code').value==0 || document.getElementById('zip-Code').value=='0'){
		if(document.getElementById('localeId').value=='1')
		{
	
	
	displayStaticMessage('<table align="center" border="0" valign="bottom">'
			+'<tr>'
				+'<td colspan="2" height="10px  "width="100%" align="centre"><div id="validation" style="font-family:Tahoma;font-size:11px;color:#FF0000;font-weight:normal;text-align:centre;"></div></td>'
			+'</tr>'
			+'<tr>'
			        +'<td height="10px"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;">Please enter your Zip Code</label>'
			+'</tr>'
			+'<tr>'
			        +'<td height="10px"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;">&nbsp;&nbsp;&nbsp;to see more great offers</label>'
			+'</tr>'
            +'<tr>'
			        +'<td height="10px"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;">&nbsp;ZIP Code</label>'
			        +'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="zipCode_pr" id="zipCode_pr"  size="5" maxlength="5"></td>'
            +'</tr>'
			+'<tr>'
			        +'<td height="10px"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;"></label>'
            +'</tr>'
            +'<tr>'
            +'</tr>'
			+'<tr>'
				+'<td height="10px"><input type="checkbox" name="zipPrompt" id="zipPrompt" onclick="zipFn(this);">&nbsp;<label for="zip" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;">Do not ask me again</label></td>'
			+'</tr>'
			+'<tr >'
				+'<td height="30px" align="center" colspan="2"><input  type="image" style="cursor:pointer" src="static_content/sc/images/smartsource/bt_submit_1.gif" alt="Click to Submit"  onclick="if(!submitform()){return false;};closeMessage();"/>'
				+'&nbsp;&nbsp;<input type="image" style="cursor:pointer" src="static_content/sc/images/smartsource/btn_nothanks.gif" alt="Click here To Close Prompt"  onclick="closeMessage();return false;"/>'
				+'</td>'
				+'</tr>'
		+'</table>',false);
		document.getElementById("zipCode_pr").focus();
		}
		else if(document.getElementById('localeId').value=='2')
		{
		
	displayStaticMessageLocale('<table align="center" border="1" valign="bottom" bordercolor="#FFFFFF" rules="rows">'
			+'<tr>'
				+'<td colspan="2" height="10px  "width="100%" align="centre"><div id="validation" style="font-family:Tahoma;font-size:11px;color:#FF0000;font-weight:normal;text-align:centre;"></div></td>'
			+'</tr>'
			+'<tr>'
			        +'<td height="10px" colspan="2"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;">Veuillez sélectionner votre province pour recevoir plus d’offres</label>'
			+'</tr>'
            +'<tr>'
			          +'<td colspan="2" align="center">&nbsp;&nbsp;&nbsp;<select id="zipCode_pr" name="zipCode_pr" size="1"  tabindex="11" style="font-family:Tahoma;font-size:11px;color:#395972;font-weight:normal;"><option value="0">---Choisissez---</option>'
			         + stateStr			          
			          +'</select></td>'
            +'</tr>'
			+'<tr>'
			        +'<td height="10px"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;"></label>'
            +'</tr>'
            +'<tr>'
            +'</tr>'
			+'<tr>'
				+'<td height="10px" colspan="2"><input type="checkbox" name="zipPrompt" id="zipPrompt" onclick="zipFn(this);">&nbsp;<label for="zip" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;">Ne plus me demander de nouveau</label></td>'
			+'</tr>'
			+'<tr >'
				+'<td height="30px" align="center" colspan="2"><input  type="image" style="cursor:pointer" src="static_content/sc/images/smartsource/bt_submit_ca.gif" alt="Cliquez pour valider"  onclick="if(!submitform()){return false;};closeMessage();"/>'
				+'&nbsp;&nbsp;<input type="image" style="cursor:pointer" src="static_content/sc/images/smartsource/btn_nothanks_ca.gif" alt="Cliquez ici pour fermer l\'invite"  onclick="closeMessage();return false;"/>'
				+'</td>'
				+'</tr>'
		+'</table>',false);
		document.getElementById("zipCode_pr").focus();
		}
		else if(document.getElementById('localeId').value=='3')
		{
		
			displayStaticMessage('<table align="center" border="0" valign="bottom">'
					+'<tr>'
						+'<td colspan="2" height="10px  "width="100%" align="center"><div id="validation" style="font-family:Tahoma;font-size:11px;color:#FF0000;font-weight:normal;text-align:centre;"></div></td>'
					+'</tr>'
					+'<tr>'
					        +'<td height="10px" colspan="2" align="center"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;text-align:centre;" class="txt_blue_small" >Please select your province  </label>'
					+'</tr>'
					+'<tr>'
					        +'<td height="10px" colspan="2" align="center"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;text-align:centre;" class="txt_blue_small" >&nbsp;&nbsp;to see more great offers</label>'
					+'</tr>'
		            +'<tr>'
					        +'<td colspan="2" align="center">&nbsp;&nbsp;&nbsp;<select id="zipCode_pr" name="zipCode_pr" size="1" class="txt_blue_small"  tabindex="11" ><option value="0" selected="selected">---Select---</option><option value="123">Alberta</option>	<option value="111">British Columbia</option>	<option value="112" >Manitoba</option>	<option value="113">New Brunswick</option>	<option value="114">New Foundland and Labrador</option>	<option value="120">Northwest territories</option>	<option value="115">Nova Scotia</option>	<option value="122">Nunavut</option>	<option value="116">Ontario</option>	<option value="117">Prince Edward Island</option>	<option value="118">Quebec</option>	<option value="119">Saskatchewan</option><option value="121">Yukon</option></select></td>'
		            +'</tr>'
					+'<tr>'
					        +'<td height="10px"><label for="zipCode_pr" style="font-family:arial;font-size:13px;font-weight:bold;" class="txt_blue_small" ></label>'
		            +'</tr>'
		            +'<tr>'
		            +'</tr>'
					+'<tr>'
						+'<td height="10px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="zipPrompt" id="zipPrompt" onclick="zipFn(this);">&nbsp;<label for="zip" style="font-family:arial;font-size:13px;font-weight:bold;" class="txt_blue_small">Do not ask me again</label></td>'
					+'</tr>'
					+'<tr >'
						+'<td height="30px" align="center" colspan="2"><input  type="image" style="cursor:pointer" src="static_content/sc/images/smartsource/bt_submit_1.gif" alt="Click to Submit"  onclick="if(!submitform()){return false;};closeMessage();"/>'
						+'&nbsp;&nbsp;<input type="image" style="cursor:pointer" src="static_content/sc/images/smartsource/btn_nothanks.gif" alt="Click here To Close Prompt"  onclick="closeMessage();return false;"/>'
						+'</td>'
						+'</tr>'
				+'</table>',false);
			document.getElementById("zipCode_pr").focus();
		}
		}
}
	if(document.getElementById('localeId') && document.getElementById('localeId').value != 1) {
		if(document.getElementById('zip-Code')&& document.getElementById('zip-Code').value==''){
			document.getElementById('zip-Code').value = 0;
		}
	}
}
//Html Content For the Modal Dialog for Java Opt Message
function displayLink(){
	//alert(navigator.userAgent);
	if(document.couponForm){
	if(document.couponForm.javaDetectOpt.value == "DisplayPrompt"){
	
		JavaTracking(document.couponForm.userId.value,"1",document.couponForm.JavaDetectId.value,"Insert");
	if(document.getElementById('localeId').value=='1')
	{
		displayJavaOptMessage('<div style="display:inline" id="javadetect"><table align="center" border="0" valign="bottom">'
			+'<tr><td height="10px"/></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" align="center"><label for="zipCode_pr" style="font-family:arial;font-size:14px;font-weight:bold;color:#395771;align:center">An update may be required to print your coupon(s)</label></td></tr>'
			+'<tr><td height="10px"/></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" ><label for="zipCode_pr" style="font-family:arial;font-size:12px;font-weight:bold;color:#395771;align:center">Step 1 of 2 - Check for Java </label></td></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" ><label for="zipCode_pr" style="font-family:arial;font-size:12px;font-weight:bold;color:#395771;align:center">You must have Java installed in order to print your coupon(s). Click "Yes" below to check for Java now.</label></td></tr>'
			+'<tr><td  height="10px" align="right" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;" ><input type="radio" name="detectOpt" value="1" id="detectOpt" onclick="submitOptin();">Yes</input></td>'
			+'<td  height="10px" align="left" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;" ><input type="radio" name="detectOpt" value="0"  id="detectOpt" onclick="submitOptOut();">No</input></td></tr></table><div>',false);
	}
		
	else if(document.getElementById('localeId').value=='2')
	{
		displayJavaOptMessage('<div style="display:inline" id="javadetect"><table align="center" border="0" valign="bottom">'
			+'<tr><td height="10px"/></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" align="center"><label for="zipCode_pr" style="font-family:arial;font-size:14px;font-weight:bold;color:#395771;align:center">Une mise Ã  jour peut Ãªtre nÃ©cessaire pour imprimer votre coupon(s)</label></td></tr>'
			+'<tr><td height="10px"/></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" ><label for="zipCode_pr" style="font-family:arial;font-size:12px;font-weight:bold;color:#395771;align:center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Étape 1 sur 2 : Vérifier Java</label></td></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" ><label for="zipCode_pr" style="font-family:arial;font-size:12px;font-weight:bold;color:#395771;align:center">Vous devez avoir installÃ© Java afin d\'imprimer votre coupon (s). Cliquez sur Â"OuiÂ" ci-dessous pour vÃ©rifier Java maintenant.</label></td></tr>'
			+'<tr><td  height="10px" align="right" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;" ><input type="radio" name="detectOpt" value="1" id="detectOpt" onclick="submitOptin();">Oui</input></td>'
			+'<td  height="10px" align="left" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;" ><input type="radio" name="detectOpt" value="0"  id="detectOpt" onclick="submitOptOut();">Non</input></td></tr></table><div>',false);
	}
	
	else if(document.getElementById('localeId').value=='3')
	{
		displayJavaOptMessage('<div style="display:inline" id="javadetect"><table align="center" border="0" valign="bottom">'
			+'<tr><td height="10px"/></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" align="center"><label for="zipCode_pr" style="font-family:arial;font-size:14px;font-weight:bold;color:#395771;align:center">An update may be required to print your coupon(s)</label></td></tr>'
			+'<tr><td height="10px"/></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" ><label for="zipCode_pr" style="font-family:arial;font-size:12px;font-weight:bold;color:#395771;align:center">Step 1 of 2 - Check for Java </label></td></tr>'
			+'<tr>'
			+'<td colspan="5" height="10px" width="450px" ><label for="zipCode_pr" style="font-family:arial;font-size:12px;font-weight:bold;color:#395771;align:center">You must have Java installed in order to print your coupon(s). Click "Yes" below to check for Java now.</label></td></tr>'
			+'<tr><td  height="10px" align="right" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;" ><input type="radio" name="detectOpt" value="1" id="detectOpt" onclick="submitOptin();">Yes</input></td>'
			+'<td  height="10px" align="left" style="font-family:arial;font-size:13px;font-weight:bold;color:#395771;" ><input type="radio" name="detectOpt" value="0"  id="detectOpt" onclick="submitOptOut();">No</input></td></tr></table><div>',false);
	}
		
		
		
	}
	else{
		staticcontent();
	}
	}
	if(document.frmLoadApplet || document.frmLoadSmartPrint){
		//alert('inside applet form');
		var t=setTimeout("displaymac()",15000);
	}	
	//displaySelectBoxes();
	//OnClientClose();
	//document.couponForm.submit();
	
}

function displaymac(){
	if(document.frmLoadApplet && (document.frmLoadApplet.appletload.value != 'true' && document.frmLoadApplet.javaEnable)){
	//alert('MAC'+document.frmLoadApplet.appletload.value);
	//alert('Normal Print');
		document.frmLoadApplet.command.value="ForwardCommand";
  	    document.frmLoadApplet.printClient.value="Applet";
		document.frmLoadApplet.toPage.value="checkOS";
		document.frmLoadApplet.submit();
		
	} else if(document.frmLoadSmartPrint && (document.frmLoadSmartPrint.appletload.value != 'true' && document.frmLoadSmartPrint.javaEnable)){
	//alert('MAC'+document.frmLoadSmartPrint.appletload.value);
	//alert('SmartPrint');
		document.frmLoadSmartPrint.command.value="ForwardCommand";
  	    document.frmLoadSmartPrint.printClient.value="Applet";
		document.frmLoadSmartPrint.toPage.value="checkOS";
		document.frmLoadSmartPrint.submit();
		
	}
}
//Java Static Opt Prompt
function displayJavaOptMessage(messageContent,cssClass)
{
	messageObj.setHtmlContent(messageContent);
	messageObj.setSize(500,135);
	messageObj.setCssClassMessageBox(cssClass);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(true);	// Disable shadow for these boxes	
	messageObj.display();
}

function submitOptin(){
	var osNam;		
	var browserName = "Unknown Browser";
	if(BrowserDetect.browser != null && BrowserDetect.browser.length > 0)
	{		
		browserName = BrowserDetect.browser + " " +BrowserDetect.version;
	}
	if(BrowserDetect.OS != null && BrowserDetect.OS.length > 0)
	{		
		osNam = BrowserDetect.OS;
	}
	
	document.couponForm.osDetails.value=osNam;
	document.couponForm.browserName.value=browserName;
	document.couponForm.command.value='JavaDetectionCommand';	
	document.couponForm.javaDetectOpt.value = "Y";
	document.couponForm.submit();
}

function submitOptOut(){
	document.couponForm.command.value='JavaDetectionCommand';	
	document.couponForm.javaDetectOpt.value = "N";
	document.couponForm.submit();
}
//Submit Form For  the  Modal Dialog
function submitform(){
    document.getElementById('validation').innerHTML='';
	var zipCode=document.getElementById('zipCode_pr');
	var promptCheck=document.getElementById('zipPrompt');
	var localeId = document.getElementById('localeId').value;
	document.getElementById('promptClicked').value='Y';
  if(promptCheck.checked){
	document.getElementById('prompt_check').value='Y';
  }else{
	document.getElementById('prompt_check').value='N';
  }
  if(checkZipCode(zipCode,localeId)){
	  if(localeId == 2) {
		  document.getElementById('validation').innerHTML='S\'il vous plaÃ®t Entrez province valide';
	  } else {
		  document.getElementById('validation').innerHTML='Please Enter Valid ZIP Code';
	  }
	document.getElementById("zipCode_pr").focus();
  }else{
	displaySelectBoxes();
	OnClientClose();
	document.getElementById('zipCode').value = zipCode.value;	
	document.getElementById('validation').value='';
	document.couponForm.command.value='CouponDisplayCommand';
	document.couponForm.pageNo.value="1";
	document.couponForm.submit();
 }
}
/**
 * Hides all drop down form select boxes on the screen so they do not appear above the mask layer.
 * IE has a problem with wanted select form tags to always be the topmost z-index or layer
 *
  */	
function hideSelectBoxes() {
  document.getElementById("displayValue").disabled=true;
  document.getElementById("brandValue").disabled=true;
  }
/**
 * Makes all drop down form select boxes on the screen visible so they do not 
 * reappear after the dialog is closed.
 * 
 * IE has a problem with wanting select form tags to always be the 
 * topmost z-index or layer.
 */
function displaySelectBoxes() {
   document.getElementById("displayValue").disabled=false;
    document.getElementById("brandValue").disabled=false;
}
// For IE.  Go through predefined tags and disable tabbing into them.
function disableTabIndexes() {
		var gTabIndexes = new Array();
		// Pre-defined list of tags we want to disable/enable tabbing into
		var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");
	if (document.all) {
		var i = 0;
		for (var j = 0; j < gTabbableTags.length; j++) {
			var tagElements = document.getElementsByTagName(gTabbableTags[j]);
			for (var k = 0 ; k < tagElements.length; k++) {
				gTabIndexes[i] = tagElements[k].tabIndex;
				tagElements[k].tabIndex="-1";
				i++;
			}
		}
	}
}

// For IE. Restore tab-indexes.
function restoreTabIndexes() {
var gTabIndexes = new Array();
var gTabbableTags = new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME");
	if (document.all) {
		var i = 0;
		for (var j = 0; j < gTabbableTags.length; j++) {
			var tagElements = document.getElementsByTagName(gTabbableTags[j]);
			for (var k = 0 ; k < tagElements.length; k++) {
				tagElements[k].tabIndex = gTabIndexes[i];
				tagElements[k].tabEnabled = true;
				i++;
			}
		}
	}
}

// Tab key trap. iff popup is shown and key was [TAB], suppress it.
// @argument e - event - keyboard event that caused this function to be called.
function keyDownHandler(e) {
var gPopupIsShown=document.getElementById('validation');
if (document.couponForm&&gPopupIsShown!=null&&gPopupIsShown.value!=''){ 
if(e.keyCode == 9){return false;}// This Is Used For Tab Key Trap Method
if(e.keyCode ==13){submitform();}// This Submit Key Trap is used To Submit The Form on Enter 
    }
}

function OnClientShow()
        { 
            if (document.all)
            {               
                document.body.scroll = "no";
            }
            else
            {
                var oTop = document.body.scrollTop;
                document.body.style.overflow = "hidden";
                document.body.scrollTop = oTop;
            }
        }
		
function OnClientClose()
   {
	document.body.scroll = "yes";
	document.body.style.overflow = 'scroll';
  }

	//End 	

