



var myShowForm=false;
var myContentForm = false;
var form_element_prefix = "ctl00_Main_";
var Proto_Prefix = (("https:" == document.location.protocol) ? "https://" : "http://");
var GB_ROOT_DIR =  Proto_Prefix+greyboxPath(window.location.href)+"/admin/code/JavaScript/greybox/";

function greyboxPath(url_)
{
	url_ = (url_.indexOf('http://') > -1) ? url_.substring(7,url_.length) : url_.substring(8,url_.length);
	url_ = url_.substring(0,url_.indexOf('/'))
	return url_;
}


function greyboxPath(url_)
{
	url_ = (url_.indexOf('http://') > -1) ? url_.substring(7,url_.length) : url_.substring(8,url_.length);
	url_ = url_.substring(0,url_.indexOf('/'))
	return url_;
}

function ShowContent(d, e) 
{
	if (document.getElementById(d).style.display == "inline") {
		document.getElementById(d).style.display ="none"
	}
	else
	{
		document.getElementById(d).style.display ="inline";
	}
	if (e != '') 
	{
		document.getElementById(e).style.display ="none";
	}
}

function CommentChange() {
	var len = document.getElementById('ctl00_Main_UserControl_Blog_txtComm').value
	if (1000 - len.length <= 0){
		document.getElementById('ctl00_Main_UserControl_Blog_txtComm').value = len.substring(0, 6000);
		alert('You have entered the max characters!');
	}
	else
	{
	document.getElementById('ctl00_Main_UserControl_Blog_txtCount').value = 6000 - len.length;
	}
	
}

function ManageContent(Action,thisIDname,thisIDvalue,PartNumber,FileName,K_){
			
	if (myContentForm){
		myContentForm.close();
	}
	
	if(Action=="D"){
		if(document.getElementById('current_content_container')){
			document.getElementById('current_content_container').value="|"+thisIDname+","+thisIDvalue+","+PartNumber+","+K_+"|";
			return false;
		}else{
			return false;
		}
	}
	
	K_ = K_ ? K_ : 0;

//	myContentForm = window.open('/admin/code/Content/ContentForm/ContentForm_'+FileName+'_'+PartNumber+'.aspx?A='+Action+'&B='+thisIDname+'&C='+thisIDvalue+'&D='+PartNumber+'&E='+K_,'ContentManage','toolbars=no,scrollbars=yes,status=yes,location=no,width=600,height=575,resizable=yes,left=10,top=10,postionx=10,positiony=10');
	GB_showCenter('Manage Content','/admin/code/Content/ContentForm/ContentForm_'+FileName+'_'+PartNumber+'.aspx?A='+Action+'&B='+thisIDname+'&C='+thisIDvalue+'&D='+PartNumber+'&E='+K_,700,900);


}


function ShowAddUpdate(FileName,Action,Args,PopUp){

	var isMac = navigator.userAgent.indexOf('Mac') != -1 
		
	if (isMac){
		if (Args){
			if(Args.substring(1,1) != "&"){
				Args = '&'+Args
			}
		}else{
			Args = ''
		}	
	}else{
		if ((Args != undefined) && (Args != '')){
			if(Args.substring(1,1) != "&"){
			Args = '&'+Args
			}
		}else{
			Args = ''
		}
	}
	
	var formName = 'formName'

	var xtraArgs = document.location.href;
	if(xtraArgs.indexOf('?')>0){
		xtraArgs = xtraArgs.substring(xtraArgs.indexOf('?')+1,xtraArgs.length);
		if(Action=="U" || Action=="S" &&Args.indexOf('PK=')>-1){
			xtraArgs=xtraArgs.replace(/PK=[\S]*?&/gi,"");
		}
	}else{
		xtraArgs = "";
	}

	if(Args!=""&&xtraArgs!=""){xtraArgs='&'+xtraArgs;}
	Args += xtraArgs; 
	if(Args!=""&&Args.substring(0,1)!='&'){
		Args='&'+Args;
	}
	if(myShowForm){
		myShowForm.close();
	}
	


	var prefixPath = "/admin/code/AddUpdatePages/";	
	if(PopUp){
		prefixPath = "/admin/code/PopUp/";
	}

//	myShowForm = window.open(prefixPath+FileName+'?A='+Action+Args,formName,'toolbars=no,scrollbars=yes,status=yes,location=no,width=600,height=575,resizable=yes,left=10,top=10,postionx=10,positiony=10');
//	myShowForm.focus();
	
	//GB_showCenter('Manage Form', prefixPath+FileName+'?A='+Action+Args,700,900);
	GB_showCenter('Manage Form', prefixPath+FileName+'?A='+Action+Args,720,900);
}


function ShowPopUp(FileName,useGreyBox,width,height){
	var formName = 'formName'+FileName.replace(/[^a-zA-Z]/gi,"");
	var prefixPath = "/admin/code/PopUp/";

	if (useGreyBox){
		//alert(width);
		GB_showCenter('Form Management',prefixPath+FileName,height,width);
	}else{
		var myPopUpForm = window.open(prefixPath+FileName,formName,'toolbars=no,scrollbars=yes,status=yes,location=no,width=900,height=625,resizable=yes,left=10,top=10,postionx=10,positiony=10');
		myPopUpForm.focus();
	}
}


function closeForm(){
	
	try{
		parent.parent.GB_hide();
	} catch(err){
		opener.document.location.href=opener.document.location.href;
		window.close();
	}
}

function closePopUp(){
	try{
		parent.parent.GB_hide();
	} catch(err){
		window.close();
	}
}



function RunOrderByColumnName(ColumnName){

	if(document.getElementById('ctl00_Main_OrderByColumnName')){
		var currOrderByColumnName = document.getElementById('ctl00_Main_OrderByColumnName')
		if(currOrderByColumnName.value==ColumnName+' ASC'){
			currOrderByColumnName.value=ColumnName+' DESC';
		}else{
			currOrderByColumnName.value=ColumnName+' ASC';
		}
			
	}
	document.forms[0].submit();
}



function showPrint(PrintKey){
	var myPrint = window.open('/admin/code/Print/ManagePrint.aspx?A='+PrintKey,PrintKey,'toolbars=yes,scrollbars=yes,status=yes,location=no,width=650,height=575,resizable=yes,left=10,top=10,postionx=10,positiony=10');
	myPrint.focus();

}

function showPrintPage(Page){
	var URL = "/Admin/Code/PopUp/PopUp_Print.aspx?page="+Page;
	GB_showCenter('Print Page',URL,null,778);

}




function ChangePage(Action,To,Step){
	var regRetVal = new RegExp(/retVal=[\S|\s]*/gi);
	var regURL = new RegExp(/http:\/\/[\S]*?\.[\S]*?\//i);
	var retVal = regRetVal.exec(document.location.href); 
	retVal = retVal ? retVal[0] : "";

	var baseURL = regURL.exec(document.location.href);
	baseURL = baseURL[0];
	var currPage = document.location.href;
	currPage = currPage.substring(baseURL.length-1,currPage.length);
	Step = Step ? Step : 0;


	if(Action=="BACK"){
		var itemName="";itemValue="";itemArray = new Array();
		retVal = retVal.replace(/\%3a/gi,":");
		retVal = retVal.replace(/\%7C/gi,"|");
		if(retVal.substring(0,7)=='retVal='){
			retVal = retVal.substring(7,retVal.length);
		}
		var retHistory = retVal.split(/\|/gi);
		for(k=0;k<retHistory.length;k++){
			itemName = retHistory[k].substring(0,retHistory[k].indexOf(':'))
			itemValue = retHistory[k].substring(retHistory[k].indexOf(':')+1,retHistory[k].length);
			itemArray[itemName] = URLDecode(itemValue);
		}
		

		if(itemArray.length>=Step){
			if(itemArray[Step].indexOf('&retVal=')>0){
				retVal = itemArray[Step];
				retVal = retVal.substring(retVal.indexOf('&retVal=')+8,retVal.length)
				itemArray[Step] = itemArray[Step].substring(0,itemArray[Step].indexOf('&retVal=')+7)+"="+URLEncode(retVal)+'|';
			} 
			document.location.href = itemArray[Step];
		}else{
			alert('Could not find Step in the retVal of the previous querystring');
			return false;
		}
	
	}else if(Action=="NEXT"){
		// append to retVal if applicable		
		if(retVal){
			currPage = (currPage.substring(currPage.length-1,currPage.length)!='|') ? currPage+'|' : currPage;
			retVal+=Step+":"+URLEncode(currPage)
			if (To.indexOf("?")==-1){
				To+='?'+retVal;
			}else{
				To+="&"+retVal;
			}
			document.location.href = To;
		}else{
			retVal = "&retVal="+Step+":"+URLEncode(currPage)+'|'
			To+=retVal;
			document.location.href = To;
		}	
		
	}else{
		alert('No Action Specified: BACK OR NEXT');
		return false;
	}

}



function Get_Cookie(name) { 
   var start = document.cookie.indexOf(name+"="); 
   var len = start+name.length+1; 
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
   if (start == -1) return null; 
   var end = document.cookie.indexOf(";",len); 
   if (end == -1) end = document.cookie.length; 
   return unescape(document.cookie.substring(len,end)); 
} 

function Set_Cookie( name, value, expires, path, domain, secure ){
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/

if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}


function Delete_Cookie(name,path,domain) { 
   if (Get_Cookie(name)) document.cookie = name + "=" + 
      ( (path) ? ";path=" + path : "") + 
      ( (domain) ? ";domain=" + domain : "") + 
      ";expires=Thu, 01-Jan-70 00:00:01 GMT"; 
} 





function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}


function URLDecode (encodedString) {
  var output = encodedString;
  var binVal, thisString;
  var myregexp = /(%[^%]{2})/;
  while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
    binVal = parseInt(match[1].substr(1),16);
    thisString = String.fromCharCode(binVal);
    output = output.replace(match[1], thisString);
  }
  return output;
}




//Drop-Down Menu Start

var DDSPEED = 2;
var DDTIMER = 2;

// main function to handle the mouse events //
function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.display = 'block';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
  }
}

// collapse the menu //
function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}

//Drop-Down Menu Stop



// checkout form //
function setforms(itemtype,obj,altprefix){
//	if(obj.value.toUpperCase()=='NEW'){
//		document.getElementById('new'+itemtype).style.display='block';
//		document.getElementById(itemtype).style.display='none';
//	}else{
//		document.getElementById('new'+itemtype).style.display='none';
//		document.getElementById(itemtype).style.display='none';
//	}	
	var prefix = altprefix ? altprefix : "ctl00_Main_UserControl_Checkout_1_";


	if(obj.value=='New')
	{
		var tprefix = prefix + ((itemtype.indexOf('bill')>-1) ? "b" : "s");
		var fields = new Array(tprefix+"nickname",tprefix+"fname",tprefix+"lname",tprefix+"address1",tprefix+"address2",tprefix+"city",tprefix+"state",tprefix+"zipcode",tprefix+"phonenumber",tprefix+"country");
		for(j=0;j<fields.length;j++){
			if(document.getElementById(fields[j])){
				document.getElementById(fields[j]).value='';
			}
		}
		return true;
	}

	// run against the value
	var val = obj.value.substring(obj.value.indexOf('{[')+2,obj.value.length);
	val = val.substring(0,val.indexOf(']}'));
	if(val){
		var vals = val.split('][');
		for(j=0;j<vals.length;j++){
			if(vals[j].indexOf('=')>-1){
				var n = vals[j].substring(0,vals[j].indexOf('='))
				var v = vals[j].substring(vals[j].indexOf('=')+1,vals[j].length);
				if(document.getElementById(prefix+n)){
					document.getElementById(prefix+n).value=v;
					if(n.indexOf('country')>-1){
						document.getElementById(prefix+n.substring(0,1)+'state').disabled = (v == 'US' || v == 'CA') ? false : true;
					}
				}
			}	
		}	
	}
	
	
	// if country <> US or CA then disable state
	
	// toggle sameas div
//	if(itemtype.value=='shipto'){
//		document.getElementById('sameas').style.display =  (obj.value.toUpperCase()=='NEW') ? 'block' : 'none';
//	}
		

}

function setpayment(val,altprefix){
	var fprefix = altprefix ? altprefix : "ctl00_Main_UserControl_Checkout_1_";
	var fields = new Array("MemberPrice_","NonMemberPrice_","Purchase_","RentToBuy_");
	val = val ? val : fprefix+fields[0];
	var showbox = true;
	
	// iterate through and set value to unchecked
	for(j=0;j<fields.length;j++){
		for(k=0;k<2;k++){
			var f = document.getElementById(fprefix+fields[j]+k);
			if(f){
				if((val+'_'+k)!=f.id){
				f.checked=false;
				}
			}
		}
	}
	
	// hide holding charge if we have a RentToBuy_
	var r = new Array();
	r[0] = document.getElementById(fprefix+fields[2]+'0');
	r[1] = document.getElementById(fprefix+fields[2]+'1');
	r[2] = document.getElementById(fprefix+fields[3]+'0');
	r[3] = document.getElementById(fprefix+fields[3]+'1');	
	for(j=0;j<r.length;j++){
		if(r[j]){
			if(r[j].checked){
				if(document.getElementById(fprefix+'holdingchargecontainer')) document.getElementById(fprefix+'holdingchargecontainer').style.display='none';
				if(document.getElementById(fprefix+'insuranceitem')) document.getElementById(fprefix+'insuranceitem').style.display='none';
				// show the no insurance box
				if(document.getElementById('insuranceitemnone')) document.getElementById('insuranceitemnone').style.display='block';
				// set the insurance list box to -1
				for(n=0;n<2;n++){
					if(document.getElementById(fprefix+'AcceptInsurance_'+n)){
						document.getElementById(fprefix+'AcceptInsurance_'+n).checked = false;
					}
				}
				showbox = false;
				break;
			}
		}
	}
	
	// if we are shoing the box show it.
	if(showbox){
		if(document.getElementById(fprefix+'holdingchargecontainer')) document.getElementById(fprefix+'holdingchargecontainer').style.display='block';
		if(document.getElementById(fprefix+'insuranceitem')) document.getElementById(fprefix+'insuranceitem').style.display='block';	
		if(document.getElementById('insuranceitemnone')) document.getElementById('insuranceitemnone').style.display='none';		
	}
	
	
	// hide membership form
	// if a member option is checked leave it else hide
	var o = new Array();
	showbox = false;
	o[0] = document.getElementById(fprefix+fields[0]+'0');
	o[1] = document.getElementById(fprefix+fields[0]+'1');
	o[2] = document.getElementById(fprefix+fields[2]+'0');
	o[3] = document.getElementById(fprefix+fields[3]+'1');

	for(j=0;j<o.length;j++){
		showbox = o[j] ? o[j].checked : showbox;
		if(showbox) break;
	}

	try
	{
		if (showbox) updateshipping(1);
		document.getElementById(fprefix+'membershipcont').style.display = showbox ? 'block' : 'none';
	}catch(e){
		//alert(e);
	}
	
	// hide the rent to buy if a guest
//	var p as new Array();
//	var p[0] = document.getElementById(fprefix+fields[1]+'0');
//	var p[1] = document.getElementById(fprefix+fields[1]+'1');
//	var showbox = false;
//	for(j=0;j<o.length;j++){
//		showbox = p[j] ? p[j].checked : showbox;
//		if(showbox) break;
//	}

//	try
//	{
		// hide rent to buy if
//		if (showbox) updateshipping(0);
//		document.getElementById('ctl00_Main_UserControl_Checkout_1_prenttobuy').style.display = !showbox ? 'block' : 'none';
//	}catch(e){
		//alert(e);
//	}

	// make sure first option in membership is checked
	if(showbox&&document.getElementById(fprefix+"MembershipOptions_0")){
		for(k=0;k<10;k++){
			var f = document.getElementById(fprefix+"MembershipOptions_"+k);
			if(f){
				if (f.checked){
					return true;
				}
			}
		}
		// nothing is checked, check first item
		document.getElementById(fprefix+"MembershipOptions_0").checked = true;
	}else if(!document.getElementById(fprefix+"MembershipOptions_0")){
		updateshipping(1);
	}else{
		updateshipping(0);
	}
	
}
	


function copyBilling(prefix)
{
	
	if(document.getElementById('ctl00_Main_UserControl_Checkout_1_PaymentMethod')){
		document.getElementById('ctl00_Main_UserControl_Checkout_1_PaymentMethod').value='New'
	}

	var prefixfrom = prefix ? prefix + "b" : "ctl00_Main_UserControl_Checkout_1_b";
	var prefixto = prefix ? prefix + "s" : "ctl00_Main_UserControl_Checkout_1_s";
	
     document.getElementById(prefixfrom+'nickname').value = document.getElementById(prefixto+'nickname').value;
	 document.getElementById(prefixfrom+'fname').value = document.getElementById(prefixto+'fname').value;
     document.getElementById(prefixfrom+'lname').value = document.getElementById(prefixto+'lname').value;
     document.getElementById(prefixfrom+'address1').value = document.getElementById(prefixto+'address1').value;
     document.getElementById(prefixfrom+'address2').value = document.getElementById(prefixto+'address2').value;
     document.getElementById(prefixfrom+'city').value = document.getElementById(prefixto+'city').value;
     document.getElementById(prefixfrom+'zipcode').value = document.getElementById(prefixto+'zipcode').value;
     document.getElementById(prefixfrom+'state').value = document.getElementById(prefixto+'state').value;
     document.getElementById(prefixfrom+'country').value = document.getElementById(prefixto+'country').value;
     document.getElementById(prefixfrom+'phonenumber').value = document.getElementById(prefixto+'phonenumber').value;

	// disable state if applicable	
	document.getElementById(prefixfrom+'state').disabled = document.getElementById(prefixto+'state').disabled
		
	
}


function updateshipping(mtype,alt){
	// processes against shipHash[] array(value,name,mtype)
		
	// double the catch
	try{
		if(!shipHash) return false;
	}catch(e){
		return false;
	}

	// make sure there is no undefined
	alt = alt == undefined ? false : alt;


	// need to set mtype 
	if (alt){
		R = document.getElementsByName(mtype);
		for(j=0;j<R.length;j++){
			if(R[j].checked) {
				mtype = isNumeric(R[j].value) ? 1 : 0;
				break;
			}
		}
	}
	

	if (!shipHash) return false;
	// get field obj
	var fieldname = alt ? alt : 'ctl00_Main_UserControl_Checkout_1_ShippingMethod';
	var fieldobj = document.getElementById(fieldname);
	if (!fieldobj) return false;
	
	// clear it
	RemoveOptions(fieldobj.id);
	
	// iterate
	for(j=0;j<shipHash.length;j++){
		var a = shipHash[j];
		if(a.length==3){
			if(a[2]==mtype){
				addOption(fieldobj,a[1],a[0]);
			}
		}
	}
	
	
}

function isNumeric(x) {
var RegExp = /^(-)?(\d*)(\.?)(\d*)$/; 
var result = x.match(RegExp);
return result;
}

function addOption(field,name,value){
	var anOption = document.createElement("OPTION") 
	field.options.add(anOption)
	anOption.value = value;
	anOption.innerText = name;
	anOption.textContent = name;
}



function RemoveOptions(FieldID){
	if(document.getElementById(FieldID)){
		var L_=document.getElementById(FieldID).options.length;
		if(document.getElementById(FieldID).options.length > -1){
			for(z=0;z<L_;z++){
				document.getElementById(FieldID).remove(0);
			}
		}
	}
}

function moveimg(id,src,srclrg,title){

	MagicZoom_stopZooms();
	MagicZoom_$(id).innerHTML = '<a href="'+srclrg+'" id="zoom1" rel="zoom-position: custom" title="'+title+'" class="MagicZoom"><img src="'+src+'"/></a>';
	setTimeout('MagicZoom_findZooms()', 100);

}

function defaultEmail(data){
	
	var x_to = "";
	var x_from = "";
	var x_subject = "";
	var x_body = "";
	
	data = data.substring(1,data.length-2);
	var items = data.split('>|<');
	try	{
			x_to = items[0];
			x_from = items[1];
			x_subject = items[2];
			x_body = items[3];
		}catch(e){
			//alert(e);
		}	
	
	if(x_to) document.getElementById('ctl00_Main_ToValue').value = x_to;
	if(x_from) document.getElementById('ctl00_Main_From').value = x_from;
	if(x_subject) document.getElementById('ctl00_Main_Subject').value = x_subject;
	if (x_body) tinyMCE.activeEditor.setContent(x_body);
	
}


function manageCountry(c,fieldid,z){

	var x=document.getElementById(fieldid);
	x.disabled = (c.value=='US' || c.value=='CA') ? false : true;
	if(!x.disabled&&z){
		document.forms[0].submit();
	}else{
		x.value='';
	}

}

function getChecked(fieldName){
	var fieldArray = document.getElementsByName(fieldName);
	var list = "";
	for (j=0;j<fieldArray.length;j++){
		if(fieldArray[j].checked){
			var val = fieldArray[j].value;
			if(val!=''&&list.indexOf(val)==-1){
				if(list==""){
					list = val + ";";
				}else{
					list = list + val + ";"
				}
			}
		}
	}	
	return list;
}

function CheckAll(fieldName){
	var fieldArray = document.getElementsByName(fieldName);
	for (j=0;j<fieldArray.length;j++){
		fieldArray[j].checked = fieldArray[j].checked ? false : true;
	}
}

function tos(checked,obj){
	
	if(checked){
		try{
			if(obj){
				obj.style.visibility = 'hidden';
			}
		}catch(e){
			return true;
		}
		return true;
	}else{
		alert('You must agree to the terms and conditions before ordering');
		return false;
	}

}


function disableEnterKey(e)
{
     var key;     
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox     

     return (key != 13);
}
