
var br
if(navigator.appName == "Netscape" && navigator.appVersion.charAt(0)=="4"){br="N";}
else if(navigator.appName == "Microsoft Internet Explorer" && document.all != null){br="IE";}
else if(navigator.appName == "Netscape" && document.getElementById != null && navigator.appVersion.charAt(0)=="5"){br="N5";}
else{br=null}

var dom = (document.getElementById) ? true : false; 
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false; 
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false; 
var ns4 = (document.layers && !dom) ? true : false; 
var ie4 = (document.all && !dom) ? true : false; 
		
function getObj(id) { 
  if (dom) return document.getElementById(id);
  return (ns4) ? document.layers[id] : (ie4) ? document.all[id] : (ie5||ns5) ? document.getElementById(id) : null; 
}

// capitalize the first letter of a string and make the rest lowercase
function capitalize(astring){
	var tempstring = astring.substring(0,1).toUpperCase();
	tempstring += astring.substring(1);
	return (tempstring);
}
 
function findwords(theString){
	var firstposition = 0;
	var tempstring = "";
	theString.value = theString.value.toLowerCase();
	do{
		theString.value = capitalize(theString.value);
		firstposition = theString.value.indexOf(" ");
		if (firstposition != -1){
			tempstring += theString.value.substring(0,firstposition + 1);
			theString.value = theString.value.substring( firstposition + 1 );
		}
	}
	while ( theString.value.indexOf(" ") != -1 ) ;
	tempstring += capitalize( theString.value );
	theString.value=tempstring
	return(tempstring);
}

if(!info || info.closed){
	var info;
}
else{

}	

function openSwatch(colorcode, colorname, newitem, pd, cotton, weight30, weight40, sliver, metallic, ultratwist, holo, blendables, king, maxi, jumbo) {
var my_page = "/thread/swatch.php?colorcode="+ colorcode +"&colorname="+ colorname + "&newitem=" + newitem + 
			"&pd=" + pd + "&cotton=" + cotton + "&weight30=" + weight30 + "&weight40=" + weight40 + 
			"&sliver=" + sliver + "&metallic=" + metallic + "&ultratwist=" + ultratwist + "&holo=" + holo + 
			"&blendables=" + blendables + "&king=" + king + "&maxi=" + maxi + "&jumbo=" + jumbo;
			
if(!info || info.closed){
		info = window.open(my_page,"Swatch","height=350,width=400,scrollbars=yes");
		info.focus();
	}
	else{
		info.location = my_page;
		info.focus();
	}
}


