// Frame Buster Script
if (parent.frames.length > 0) {
    parent.location.href = self.document.location;
}

function showMore(listId,length,moreId,qtyVisible){
	var n = document.getElementById(listId).childNodes;
	var counter = 0;
	
	if (moreId!=null) { 
		if (length==null) { 
			document.getElementById(moreId).href="javascript:showMore('"+listId+"',"+qtyVisible+",'"+moreId+"',"+qtyVisible+");"
			document.getElementById(moreId).innerHTML="<img src=\"images/less.jpg\" /> Less"
		} else {
			document.getElementById(moreId).href="javascript:showMore('"+listId+"',null,'"+moreId+"',"+qtyVisible+");"
			document.getElementById(moreId).innerHTML="<img src=\"images/more.jpg\" /> More"
		}
	}
	
	length=(length!=null)?length:n.length+1;

	for (var i=0; i<n.length; i++) {
		if (n.item(i).className=="itemhidden" || n.item(i).className=="item") {
			counter++;
			if (counter<=length) {
				n.item(i).className="item";
			} else { 
				n.item(i).className="itemhidden";
			}
		}
	}
}

function checkforcookies() {
   var is_enabled = false;
   if (typeof document.cookie == 'string')
      if (document.cookie.length==0) {
         document.cookie = "test";
         is_enabled = document.cookie == 'test';
         document.cookie = '';
      } else {
         is_enabled = true;
      }
    
   if (is_enabled == false)
   {
   nocookies.innerHTML = "We have detected that your web browser has been configured with cookies turned off. <br>In order to properly track what you place into your shopping cart, your web browser must accept cookies. There is no personal identifying information stored in this cookie, only the ID of your shopping cart. If you choose not to accept cookies from Linen Source, yet still wish to purchase from Linen Source, please call 1-800-434-9812, to place your order.";
   }
}


// Clear Text Box
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}

// Cookie Checking
checkforcookies();

function checkEmail(myForm) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.rtw.value))
	{
		return (true);
	}
	alert("Invalid E-mail Address! Please re-enter.");
	return (false);
}
<!-- This script used by the VeriSign PopUp
/****************************************************
Author: Eric King
Url: http://redrival.com/eak/index.shtml
This script is free to use as long as this info is left in
Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
****************************************************/
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if (h == "none") 
{ 
	h = screen.height; 
}
if (w == "none") 
{ 
	w = screen.width; 
}
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
win=window.open(mypage,myname,settings);
win.focus();
}
// -->

function onenter(id)  // id = id of control to submit
        {
            if (event.keyCode == 13)
            {
            event.returnValue = false;
            event.cancel = true;             // these two lines stops the event activated by the enter

            document.getElementById(id).click();
            }
        }
        
function openWin(catalog_name,fp)
{
	
	regEx = /catalog_name=([^&=]*)(&|$)?/
	m=regEx.exec(location.search);
	if (m) 
	{
		catalog_name = m[1];
	}
	
	var url = "http://s7d5.scene7.com/s7ondemand/brochure/flash_brochure.jsp?company=ThompsonGroup&rw=false&sku=LS_" + catalog_name + "&config=LS_Config";
	catalog = window.open(url,'catalog');
	catalog.focus();
}

function scriptSubmit(id) 
{
	var txtBox
	if(id == 'frtw')
	{
		txtBox = document.getElementById("rtw");
	}
	else if(id == 'fsearch')
	{
		txtBox=document.getElementById("TBoxSearch");
	}
	else return false;

	var x = txtBox.value;
	if(x.indexOf('<') >= 0 || x.indexOf('>') >= 0 || x.indexOf(';') >= 0 || x.indexOf(';') >= 0 || x.indexOf('>') >= 0)
	{
		alert('<,> and ; are not allowed in text boxes');
		txtBox.focus();
		txtBox.select();
		return false;		
	}
	else
	{
		return true;
	}
}
/* YourAmigo Script */
function setCookie()
{
  if ((typeof(TLCode) != 'undefined') && (typeof(cookie_length) != 'undefined'))
  {
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+cookie_length);
  document.cookie="ADDSOURCE=" +escape(TLCode)+ ";path=/;expires=" + exdate.toGMTString();
  }
}
/* End YourAmigo Script */

var Common = new function() {
	this.setCookie = _setCookie;
	this.getCookie = _getCookie;
	
	function _setCookie(c_name,value,expiredays){
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);

		document.cookie=c_name+ "=" + escape(value) +
			((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) + ";path=/";            
	}

	function _getCookie(c_name)
	{
		if (document.cookie.length>0)
		{
			c_start=document.cookie.indexOf(c_name + "=");
			if (c_start!=-1)
			{
				c_start=c_start + c_name.length+1;
				c_end=document.cookie.indexOf(";",c_start);
				if (c_end==-1) c_end=document.cookie.length;
					return unescape(document.cookie.substring(c_start,c_end));
			}
		}
		return "";
	}	
}

var Chat = new function() {
	this.showProActivePopup = _showProActivePopup;
	this.showLiveChatPopup = _showLiveChatPopup;
	
	var showLiveHelp = Common.getCookie("LIVE_HELP");
	
	
	function _showProActivePopup(DelayInSeconds,cmName,cmCategory) {
		var w=635,h=285;
		if(showLiveHelp != "false") {
			if(DelayInSeconds>0) {
				setTimeout("Chat.showProActivePopup(0,'"+cmName+"','"+cmCategory+"')",DelayInSeconds*1000);
				return
			}
				
			if (opener && !opener.closed){
				opener.focus();
			} else {
				var point = window.center({width:w,height:h});
				var popup=dhtmlwindow.open("chatbox", "iframe", 'https://linensource.custhelp.com/cgi-bin/linensource.cfg/php/enduser/cci/ps_chat.php?channel=ProActive', "Live Chat", "width="+w+"px,height="+h+"px,resize=1,scrolling=1,left="+point.x+",top="+point.y+",center=0,", "recal");
				showLiveHelp = false;
				Common.setCookie("LIVE_HELP", showLiveHelp, null);
				cmCreatePageElementTag(cmName,cmCategory);
			}	
		}
	}

	function _showLiveChatPopup(cmName,cmCategory) {
		var w=635,h=285;
		if (opener && !opener.closed){
			opener.focus();
		} else {
			var point = window.center({width:w,height:h});
			var popup=dhtmlwindow.open("chatbox", "iframe", 'https://linensource.custhelp.com/cgi-bin/linensource.cfg/php/enduser/cci/ps_chat.php?channel=Static', "Live Chat", "width="+w+"px,height="+h+"px,resize=1,scrolling=1,left="+point.x+",top="+point.y+",center=0,", "recal");
			cmCreatePageElementTag(cmName,cmCategory)//'RNT - STATIONARY - LIVE_HELP_FOOTER','10025');			
		}
	}
}

window.size = function() {
	var w = 0;
	var h = 0;
	//IE
	if(!window.innerWidth) {
		//strict mode
		if(!(document.documentElement.clientWidth == 0)) {
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		} else {
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	} else {
		w = window.innerWidth;
		h = window.innerHeight;
	}
	
	return {width:w,height:h};
}
	
window.center = function() {
	var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:0};
	var _x = 0;
	var _y = 0;
	var offsetX = 0;
	var offsetY = -50;	
	
	_x = ((this.size().width-hWnd.width)/2)+offsetX;
	_y = ((this.size().height-hWnd.height)/2)+offsetY;
	return{x:_x,y:_y};
}
          