function toggleDisplay1(me){
	if (me.style.display=="block"){
		me.style.display="inline";
		alert("Text is now 'inline'.");
		}
	else {
		if (me.style.display=="inline"){
			me.style.display="none";
			alert("Text is now 'none'. It will reappear in three seconds.");
			window.setTimeout("blueText.style.display='block';",3000,"JavaScript");
			}
		else {
			me.style.display="block";
			alert("Text is now 'block'.");
			}
		}
	}
	
function toggleDisplay(me){
	if (me.style.display=="block"){
		me.style.display="none";
		}
	else{
		me.style.display="block";
		}
	}


//side nav func
//var ids=new Array();
//var fids=new Array();
//ids[0]="computers";
//ids[1]="electronics";
//ids[2]="telephony";
//ids[3]="software";
//fids[0]="all_computers";
//fids[1]="all_electronics";
//fids[2]="all_telephony";
//fids[3]="all_software";

function displaynav(fid){	
	hideid(fid);
	showid(fid);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<fids.length;i++){
		hideid(fids[i]);
	}		  
}

function hideid(fid) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
	    var obj=document.getElementsByTagName("div");
		var objli=document.getElementsByTagName("li");
		for(i=0;i<obj.length;i++){
			if (obj[i].className=="cates")
			{			   
			   obj[i].style.display = 'none';
			   
			}
		}
		for(i=0;i<objli.length;i++){
		     if (objli[i].className=="allcates")
			 {			   
				 objli[i].style.display = 'block';	
			 }
		}
		
		//document.getElementById(fid).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.fid.display = 'none';
		}
		else { // IE 4
			document.all.fid.style.display = 'none';
		}
	}
}

function showid(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
	    document.getElementById("allcate"+id).style.display = 'none';
		document.getElementById("cates"+id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function showids(fid) {
	//safe function to show an element with a specified id
	for (var i=0;i<fids.length;i++){
		if (fids[i]==fid){ 
			id=ids[i]
			//hide the partial list
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(id).style.display = 'none';
			}
			else {
				if (document.layers) { // Netscape 4
					document.id.display = 'none';
				}
				else { // IE 4
					document.all.id.style.display = 'none';
				}
			}
			//show full list			
			if (document.getElementById) { // DOM3 = IE5, NS6
				document.getElementById(fid).style.display = 'block';
			}
			else {
				if (document.layers) { // Netscape 4
					document.fid.display = 'block';
				}
				else { // IE 4
					document.all.fid.style.display = 'block';
				}
			}
		}
		else{
			showid(ids[i]);
		}
	}
}
//end sidenav func


//format currency with dollar sign
function formatCurrency(num) {
	var num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	var sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	var cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + '.' + cents);
	}

//check numeric value
function checknum(obj){
	if(isNaN(obj.value)){
		alert("Please enter numbers only.");
		obj.focus();
		return false;
		}
	}
				
/* the following scripts are for popups used across 
product detail pages additional scripts can be added here at a later date and 
can just be called from another location 
*/
function shipWindow(page){
	var win = window.open(page,'shipping','left=360,top=260,width=240,height=260,toolbar=0,scrollbars=0');
	win.focus();
	}
	
function emailWindow(page){
    var childWindow = open(page,'email','left=330,top=260,width=300,height=270,toolbar=0,scrollbars=0');
    if (childWindow.opener == null) childWindow.opener = self;
    childWindow.focus();
	}
	
function cvvWindow(page){
	var win = window.open(page,'cvv','left=360,top=160,width=400,height=650,toolbar=0,scrollbars=0');
	win.focus();
	}
	
function imageWindow(page){
	var win = window.open(page,'image','left=360,top=200,width=500,height=500,toolbar=0,scrollbars=yes,resizable=yes');
	win.focus();
	}	
	
function TDSpopUp(url){
	var win = window.open(url,'TDS','toolbar=0,left=360,top=200,scrollbars=0,width=570,height=420');
	win.focus();
	}	
	
function fullPagePop(page){
	var win = window.open(page,'newpage','left=360,top=200,width=800,height=600,toolbar=0,scrollbars=yes,resizable=yes');
	win.focus();
	}

//setting limit to textarea input
function checkMaxLength (textarea, evt, maxLength) {
	if (textarea.selected && evt.shiftKey) 
		// ignore shift click for select
		return true;
	var allowKey = false;
	if (textarea.selected && textarea.selectedLength > 0)
		allowKey = true;
	else {
		var keyCode = document.layers ? evt.which : evt.keyCode;
		if (keyCode < 32 && keyCode != 13)
		allowKey = true;
		else           
		allowKey = textarea.value.length < maxLength;
		}
	textarea.selected = false;
	return allowKey;
	}
		
function storeSelection (field) {
	if (document.all) {
		field.selected = true;
		field.selectedLength = 
		field.createTextRange ? document.selection.createRange().text.length : 1;
		}
	}
	
//used by PowerReviews	
function showSmallPopup(filename, height, width){
	smallWindow = window.open(filename, "smallWindow","toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height + ",top=200,left=200"); 
	if (window.focus) smallWindow.focus();
	}