//*****************
// thumbnailpop.js 
//*****************
function popImage2(imgLoc, imgTitle) {
this.imgLoc = imgLoc;
var getImage = new Image();
getImage.src = imgLoc;
// creates the pop window
var winPop = window.open("","","menu=0,status=0,resizable,location=0,scrollbars=0,width=20,height=20;");
// places the image
winPop.document.write("<html><head><title>\""+imgTitle+"\"</title><link href=\"http://images.cableorganizer.com/css/wire-management-2007-opt.css\" rel=\"stylesheet\" type=\"text/css\" /><link href=\"http://images.cableorganizer.com/css/print.css\" rel=\"stylesheet\" media=\"print\" /></head><body style=\"padding:0px;margin:0px;\"><table id=\"popBox\" align=\"center\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr id=\"popTop\"><td class=\"popHead\">Image Viewer</td><td class=\"popBtn\"><a href=\"javascript:window.print();\">PRINT</a> &nbsp;&nbsp;&nbsp; <a href=\"javascript:window.close();\">CLOSE</a></td></tr>");
winPop.document.write("<br><tr><td colspan=\"2\" align=\"center\"><img src=\""+imgLoc+"\" alt=\""+imgTitle+"\" id=\"dImage\"></td></tr></table></body></html>");
// for ie
if (navigator.appName == "Microsoft Internet Explorer") {
getImage.onload = function(){
winPop.document.getElementById("dImage").src = getImage.src;
winPop.window.resizeBy(getImage.width, getImage.height);
getImage.src = "";
}
}
// for netscape/ff
if (navigator.appName == "Netscape") {
winPop.onload = function(){
winPop.document.getElementById("dImage").src = getImage.src;
winPop.window.resizeBy(getImage.width, getImage.height);
getImage.src = "";
}
}
winPop.document.close();
}
//********************
//********************
// tabs.js
//********************
function toggleTabs(tab,lnk) {
var tabNavs = document.getElementById('tabbed-nav').getElementsByTagName('li');
var tabDivs = document.getElementById('tabbed').getElementsByTagName('div');
var selTab = document.getElementById(tab+'-tab');
var selDiv = document.getElementById(tab);
for (var i = 0; i < tabNavs.length; i++) {
if (tabNavs[i].className != 'last') tabNavs[i].className = '';
}
selTab.className = 'selected';
for (var i = 0; i < tabDivs.length; i++) {
if (tabDivs[i].className.indexOf('content') != -1) {
tabDivs[i].style.display = 'none';
}
}
selDiv.style.display = 'block';
}
//**********************
// suggestions.js
//**********************
function checkNdisplay(){if(document.getElementById("productdetail")){document.getElementById("tellUs").style.display = "block";}}
function focusClear(myId){var tempObject = document.getElementById(myId);var currentVal = tempObject.value;var testVal = "type your suggestions here";var sendButton = document.getElementById("sendButton");if (currentVal == testVal){tempObject.value = "";}
sendButton.disabled = "";}
//************************
// refer.js
//************************
var myPageName="";var myChannel="";var myEvent="";var myProduct="";var skusArray=new Array();var cleanedArray=new Array();var homePage="false";var homePageOutlet="false";var thankYouPaypal="false";var page404="false";var referrer="";if(document.referrer&&document.referrer!=""&&document.referrer.substr(0,26)!="http://cableorganizer.com/"){referrer="true";}else{referrer="false";}
//*************************
// omniture.js
//*************************
function getCategory() {
var myCategory;
var myCategoryTmp;
var myCategoryTmp2;
var myCategoryTmp3;
if ((homePage == "true") || (homePageOutlet == "true") || (thankYouPaypal == "true")) {		
	myCategory = "";
} else {
	myCategoryTmp = "";
	if (document.getElementById("category")){
	myCategoryTmp = document.getElementById("category").innerHTML;
}
	myCategoryTmp2 = myCategoryTmp.replace(new RegExp(/,/g),":");
	myCategoryTmp3 = myCategoryTmp2.replace(new RegExp(/®/g),"");
	myCategory = myCategoryTmp3.replace(new RegExp(/™/g),"");
}
return myCategory;
}

function getProductDetail() {
var myProductDetailTmp = document.getElementById("productdetail").innerHTML;  
var myProductDetailTmp2 = myProductDetailTmp.replace(new RegExp(/,/g),":");
var myProductDetailTmp3 = myProductDetailTmp2.replace(new RegExp(/®/g),"");
var myProductDetail = myProductDetailTmp3.replace(new RegExp(/™/g),"");
return myProductDetail;
}

function getSubCategory() {
var mySubCategoryTmp = document.getElementById("subcategory").innerHTML;  
var mySubCategoryTmp2 = mySubCategoryTmp.replace(new RegExp(/,/g),":");
var mySubCategoryTmp3 = mySubCategoryTmp2.replace(new RegExp(/®/g),"");
var mySubCategory = mySubCategoryTmp3.replace(new RegExp(/™/g),"");
return mySubCategory;
}

function searchSku()  {
if (thankYouPaypal != "true") {
var links = document.getElementsByTagName("a");	
var thisCategory = getCategory();

for(var i=0; i<links.length;i++){
var temp = links[i].href;
	if (temp.indexOf("sku") == -1){
	// DO NOTHING
	} else {
	skusArray[skusArray.length] = temp;
	}
}

for(var i=0;i<skusArray.length;i++){
temp = skusArray[i];
temp = temp.replace("http://cableorganizer.com/cgi-cableorganizer/sb/order.cgi?storeid=*2ad1efba8697f324607a540c07bf145c80c44dcb7f1484&dbname=products&sku=","");
temp = temp.replace("https://cableorganizer.com/cgi-cableorganizer/sb/order.cgi?storeid=*2ad1efba8697f324607a540c07bf145c80c44dcb7f1484&dbname=products&sku=",""); 
//temp = temp.replace("http://wireless.cableorganizer.com/cgi-cableorganizer/sb/order.cgi?storeid=*2ad1efba8697f324607a540c07bf145c80c44dcb7f1484&dbname=products&sku=",""); 											
//temp = temp.replace("http://cableorganizer.com/cgi-cableorganizer/sb/order.cgi?storeid=*24efb634a4deb1747c188540f5b679071c4c4fc9&dbname=products&sku=","");
//temp = temp.replace("http://cableorganizer.com/cgi-cableorganizer/sb/order.cgi?storeid=*2c0a6b68dfca71322af5eb45407ff145ed0847be4c9b414b&dbname=products&sku=","");			
temp = temp.replace("/cgi-cableorganizer/sb/order.cgi?storeid=*2ad1efba8697f324607a540c07bf145c80c44dcb7f1484&dbname=products&sku=","");
//temp = temp.replace("/cgi-cableorganizer/sb/order.cgi?storeid=*24efb634a4deb1747c188540f5b679071c4c4fc9&dbname=products&sku=","");
//temp = temp.replace("/cgi-cableorganizer/sb/order.cgi?storeid=*2c0a6b68dfca71322af5eb45407ff145ed0847be4c9b414b&dbname=products&sku=","");			
temp = temp.replace("&function=add","");
skusArray[i] = temp;	
}

for(var i=0; i<skusArray.length;i++){
var foundIt = false;
for(var j =0; j<cleanedArray.length;j++){
if (skusArray[i] == cleanedArray[j]){
foundIt = true;
}
}

if(foundIt == false){
cleanedArray[cleanedArray.length] = skusArray[i];
}
foundIt = false;	
}	

myProduct = "";
for(var i=0;i<cleanedArray.length;i++){
if (i == 0){
myProduct = ";" + cleanedArray[i] + ";;;;eVar2=" + thisCategory;
} else {
myProduct = myProduct + ",;" + cleanedArray[i] + ";;;;eVar2=" + thisCategory;
}
}
}
}

function omnitureLoad() {
var nameCategory = "Category: ";
var nameSubCategory = "SubCategory : ";
var nameProductDetail = "Product Detail: ";	
var thisCategory;
var thisProductDetail;
var thisSubCategory;
// Home Page
if (homePage == "true") {		
myPageName = "Home Page";
myChannel = "";	
myEvent = "";
}
else if (homePageOutlet == "true") {
myPageName = "Home Page Outlet";
myChannel = "";	
myEvent = "";
}
else if (page404 == "true") {
myPageName = "";
s.pageType = "errorPage";
myChannel = "";	
myEvent = "";		
}
else if (thankYouPaypal == "true") {
myPageName = "Checkout: Confirmation Page";
myChannel = "";
myEvent = "purchase";
myProduct = getCookie("paypalproducts");		
s.zip = getCookie("paypalzip");	
s.state = getCookie("paypalstate");	
s.purchaseID = mypaypalordernumber;				
}
// Product Details Pages
else if (document.getElementById("productdetail")) {				
thisCategory = getCategory();
thisProductDetail = getProductDetail();		
myPageName = nameProductDetail + thisProductDetail;
myChannel = thisCategory;
myEvent = "prodView";	
} 
// Category Pages
else {   	
thisCategory = getCategory();		
myChannel = thisCategory;				
if (document.getElementById("subcategory")) {
	var thisSubCategory = getSubCategory();
	myPageName = nameSubCategory + thisCategory + " - " + thisSubCategory;
	myEvent = "prodView";
}
else {
myPageName = nameCategory + thisCategory;
myEvent = "";
}
}			
}
/*
   name - name of the cookie
   value - value of the cookie
   [expires] - expiration date of the cookie
     (defaults to end of current session)
   [path] - path for which the cookie is valid
     (defaults to path of calling document)
   [domain] - domain for which the cookie is valid
     (defaults to domain of calling document)
   [secure] - Boolean value indicating if the cookie transmission requires
     a secure transmission
   * an argument defaults when it is assigned null as a placeholder
   * a null placeholder is not required for trailing omitted arguments
*/

function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}

/*
  name - name of the desired cookie
  return string containing value of specified cookie or null
  if cookie does not exist
*/

function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}

/*
   name - name of the cookie
   [path] - path of the cookie (must be same as path used to create cookie)
   [domain] - domain of the cookie (must be same as domain used to
     create cookie)
   path and domain default if assigned null or omitted if no explicit
     argument proceeds
*/

function deleteCookie(name, path, domain) {
if (getCookie(name)) {
document.cookie = name + "=" +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"

function fixDate(date) {
var base = new Date(0);
var skew = base.getTime();
if (skew > 0)
date.setTime(date.getTime() - skew);
}

function rand(start, end) {
return Math.floor(Math.random()*((end+1)-start)) + start;
}

/* Decimal to Hex */
var hD="0123456789ABCDEF";
function d2h(d) {
var h = hD.substr(d&15,1);
while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;}
return h;
}

/* Hex to Decimal */
function h2d(h) {return parseInt(h,16);} 

/* Any base */
function toRadix(N,radix) {
var HexN="", Q=Math.floor(Math.abs(N)), R;
while (true) {
R=Q%radix;
HexN = "0123456789abcdefghijklmnopqrstuvwxyz".charAt(R)+HexN;
Q=(Q-R)/radix; if (Q==0) break;
}
return ((N<0) ? "-"+HexN : HexN);
}

/* Base 36 to Decimal */
function t2d(t) {return parseInt(t,36);} 

/* Is Integer ? */
function isInteger(value) {
 return (parseInt(value) == value);
}
//**************************
// bookmark.js 
//**************************
//===============================================
// AddThis Bookmarking Widget  
// This notice MUST stay intact for legal use
// Copyright 2007 - AddThis.com (www.addthis.com)
//===============================================
var bookmark_prevelt;
var bookmark_url='';
var bookmark_title='';

function bookmark(elt){
bookmark_url = location.href;
bookmark_title = document.title;
var dropdown = document.getElementById('bookmark_dropdown');
if (dropdown.style.display=='none' || elt!=bookmark_prevelt){
dropdown.style.display='block';
var totpos = bookmark_cumulpos(elt);
dropdown.style.left = Math.max(6, totpos[0]-60) + 'px';
dropdown.style.top  = (totpos[1] + elt.offsetHeight) + 'px';  
} else {
dropdown.style.display='none';
}
bookmark_prevelt=elt;
return false;
}

function bookmark_hidewindow(){
var dropdown = document.getElementById('bookmark_dropdown');
dropdown.style.display='none';
return false;
}

function bookmark_favorite(){
bookmark_hidewindow();
if (document.all) 
window.external.AddFavorite(bookmark_url, bookmark_title);
else
window.sidebar.addPanel(bookmark_title, bookmark_url, '');
return false;
}

function bookmark_to(theservice){
bookmark_hidewindow();
if (theservice == "delicious"){
window.open("https://secure.del.icio.us/login?url="+encodeURIComponent(bookmark_url)+"&title="+encodeURIComponent(bookmark_title), "AddToFavorite", "scrollbars=yes,menubar=no,width=600,height=400,resizable=yes,toolbar=no,location=no,status=no");
}
if (theservice == "google"){
	var urlToUseBookmark = encodeURIComponent(bookmark_url);
	urlToUseBookmark = urlToUseBookmark.replace(/%/g,"%25");
	var titleToUse = encodeURIComponent(bookmark_title);
	titleToUse = titleToUse.replace(/%/g,"%25");
window.open("https://www.google.com/accounts/ServiceLogin?hl=en&continue=http://www.google.com/bookmarks/mark%3Fop%3Dadd%26bkmk%3D"+urlToUseBookmark+"%26title%3D"+titleToUse+"&nui=1&service=bookmarks", "AddToFavorite", "scrollbars=yes,menubar=no,width=600,height=400,resizable=yes,toolbar=no,location=no,status=no");
}
if (theservice == "su"){
window.open("http://www.stumbleupon.com/submit?url="+encodeURIComponent(bookmark_url)+"&title="+encodeURIComponent(bookmark_title), "AddToFavorite", "scrollbars=yes,menubar=no,width=600,height=400,resizable=yes,toolbar=no,location=no,status=no");
}
if (theservice == "furl"){
window.open("http://furl.net/storeIt.jsp?u="+encodeURIComponent(bookmark_url)+"&t="+encodeURIComponent(bookmark_title), "AddToFavorite", "scrollbars=yes,menubar=no,width=600,height=400,resizable=yes,toolbar=no,location=no,status=no");
}
if (theservice == "digg"){
window.open("http://digg.com/submit?phase=3&url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title), "AddToFavorite", "scrollbars=yes,menubar=no,width=600,height=400,resizable=yes,toolbar=no,location=no,status=no");
}
if (theservice == "technorati"){
window.open("http://technorati.com/faves/?add="+encodeURIComponent(location.href), "AddToFavorite", "scrollbars=yes,menubar=no,width=600,height=400,resizable=yes,toolbar=no,location=no,status=no");
}
return false;
}

function bookmark_cumulpos(a){ 
var b=0,c=0; 
do{ b+=a.offsetTop||0;
c+=a.offsetLeft||0;
a=a.offsetParent;
} while(a); 
return [c,b];
}

function bookmark_highlight(elt, hl){
if (hl)
elt.style.backgroundColor='#FFEA96';
else
elt.style.backgroundColor='';
}

function bookmark_window(){
var body = '<div id="bookmark_dropdown" style="width: 150px; position: absolute; display: none; border: #ccc solid 1px; background: #1C4B7A; padding: 1px 1px 0px 1px; overflow: hidden;">';
body+= '<table id="bookmark_header" style="height: 15px; padding: 3px; background-color: #3D6A95;" width="100%" cellpadding="0">';
body+= '<tr><td style="font-size: 14px; font-weight:bold; text-align:center; color: #F6DE7E;">Add this page to:</td></tr>';  
body+= '</table>';  
body+= '<table id="bookmark_services" width="100%" cellpadding="0" class="bookmark">';
body+= '<tr>';
if (navigator.appName == "Netscape"){
body+= '<td width="50%"><a href="/" onmouseover="bookmark_highlight(this, true)" onmouseout="bookmark_highlight(this, false)" onclick="return bookmark_favorite()"><img src="http://images.cableorganizer.com/bkmkicon/firefox.gif" style="border:none; vertical-align:middle;" > &nbsp; My Browser</a></td>';
}
else{
body+= '<td width="50%"><a href="/" onmouseover="bookmark_highlight(this, true)" onmouseout="bookmark_highlight(this, false)" onclick="return bookmark_favorite()"><img src="http://images.cableorganizer.com/bkmkicon/ie.gif" style="border:none; vertical-align:middle;" > &nbsp; My Browser</a></td>';
}
body+= '</tr><tr>'; 
body+= '<td><a href="/" onmouseover="bookmark_highlight(this, true)" onmouseout="bookmark_highlight(this, false)" onclick="return bookmark_to(\'delicious\')"><img src="http://images.cableorganizer.com/bkmkicon/delicious.gif" style="border:none; vertical-align:middle;" > &nbsp; Del.icio.us</a></td>';
body+= '</tr><tr>';
body+= '<td><a href="/" onmouseover="bookmark_highlight(this, true)" onmouseout="bookmark_highlight(this, false)" onclick="return bookmark_to(\'google\')"><img src="http://images.cableorganizer.com/bkmkicon/goog.gif" style="border:none; vertical-align:middle;"> &nbsp; Google Bookmarks</a></td>';
body+= '</tr><tr>';    
body+= '<td><a href="/" onmouseover="bookmark_highlight(this, true)" onmouseout="bookmark_highlight(this, false)" onclick="return bookmark_to(\'su\');"><img src="http://images.cableorganizer.com/bkmkicon/su.gif" style="border:none; vertical-align:middle;"> &nbsp; Stumble Upon</a></td>';
body+= '</tr><tr>';
body+= '<td><a href="/" onmouseover="bookmark_highlight(this, true)" onmouseout="bookmark_highlight(this, false)" onclick="return bookmark_to(\'furl\');"><img src="http://images.cableorganizer.com/bkmkicon/furl.gif" style="border:none; vertical-align:middle;"> &nbsp; Furl</a></td>';
body+= '</tr><tr>';  
body+= '<td><a href="/" onmouseover="bookmark_highlight(this, true)" onmouseout="bookmark_highlight(this, false)" onclick="return bookmark_to(\'digg\');"><img src="http://images.cableorganizer.com/bkmkicon/digg.gif" style="border:none; vertical-align:middle;"> &nbsp; Digg</a></td>';
body+= '</tr><tr>';
body+= '<td><a href="/" onmouseover="bookmark_highlight(this, true)" onmouseout="bookmark_highlight(this, false)" onclick="return bookmark_to(\'technorati\')"><img src="http://images.cableorganizer.com/bkmkicon/technorati.gif" style="border:none; vertical-align:middle;"> &nbsp; Technorati</a></td>';
body+= '</tr>';   
body+= '</table>';
body+= '</div>';
document.write(body);
}
bookmark_window();

