// Copyright 2009, Ameri-Brand Products Inc. All Rights Reserved

var url = location.href;
var title = document.title;
var desc = "";

var enURL = encodeURIComponent(url);
var enTITLE = encodeURIComponent(title);
var enDESC = "";

function wrt(txt){document.write(txt)}; 

// Dropdown Menu - Enhance CSS Layout
function dropdown(dropdownId, hoverClass, mouseOffDelay) {
	if(dropdown = document.getElementById(dropdownId)) {
		var listItems = dropdown.getElementsByTagName('li');
		var links = dropdown.getElementsByTagName('a');
		
		for(var i = 0; i < listItems.length; i++) {
			listItems[i].onmouseover = function() { this.className = addClass(this); }
			listItems[i].onmouseout = function() {
				var that = this;
				setTimeout(function() { that.className = removeClass(that); }, mouseOffDelay);
				this.className = that.className;
			}
			listItems[i].onclick = function() {	this.className = removeClass(this); }
			
			if (links[i] == url){
				listItems[i].className = 'thisPage';
				listItems[i].parentNode.parentNode.className = 'thisPage';
				listItems[i].parentNode.parentNode.parentNode.parentNode.className = 'thisPage';
			}
		}
	}
	
	function addClass(li) { return li.className + ' ' + hoverClass; }
	function removeClass(li) { return li.className.replace(hoverClass, ""); }
}

function createBookmark() {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.external.addPanel("Test", url,"");
	} else if ( window.external ) { // IE Favorite
		window.external.AddFavorite ( url, title );
	} else {
		var ua=navigator.userAgent.toLowerCase();
    	var isKonq=(ua.indexOf('konqueror')!=-1);
		var isMac=(ua.indexOf('mac')!=-1);
    	var selButton=isMac?'?':'CTRL';
    	if (isKonq){ alert('Please Use '+selButton+'+B to Bookmark'); }
    	else { alert('Please Use '+selButton+'+D to Bookmark'); }
	}
}

function sharePage(){
	var aLi = '<td><a onclick="window.open(this.href,\'\',\'toolbar=no,width=750,height=550,resizable=yes,scrollbars=yes\'); return false" href="http://';
	var s = new Array();
	s[s.length] = '<table cellpadding="0" cellspacing="0" border="1" style="border:1px solid #2D729D; border-collapse:collapse; background: #DCE9F0; margin-left:1px">';
    s[s.length] = '<tr><td><a href="http://www.websweeper.com/php/refer/ref-form.php?page='+enURL+'" onclick="window.open(this.href,\'\',\'toolbar=no,width=350,height=250,resizable=yes,scrollbars=yes\'); return false" class="bullEM">Email Page</a></td><td><a href="javascript:createBookmark()" class="bullBM">Bookmark</a></td></tr>';
    s[s.length] = '<tr>'+aLi+'twitter.com/?status='+enURL+'" class="bullTW">Twitter</a></td>'+aLi+'google.com/bookmarks/mark?op=add&bkmk='+enURL+'&amp;title='+enTITLE+'&amp;annotation=" class="bullGO">iGoogle</a></td></tr>';
    s[s.length] = '<tr>'+aLi+'facebook.com/share.php?u='+enURL+'" class="bullFB">Facebook</a></td>'+aLi+'digg.com/submit?url='+enURL+'&amp;media=news&amp;topic=autos" class="bullDG">Digg</a></td></tr>';
    s[s.length] = '<tr>'+aLi+'myspace.com/Modules/PostTo/Pages/?u='+enURL+'&amp;t='+enTITLE+'&amp;c='+enDESC+'" class="bullMS">MySpace</a></td>'+aLi+'delicious.com/save?v=5&noui&jump=close&url='+enURL+'&title='+enTITLE+'" class="bullDE">Delicious</a></td></tr>';
   	s[s.length] = '<tr><th colspan="2" align="center"><em class="green">Like what you see?&nbsp; Help us spread the word!</em></th></table>';
   	document.getElementById("sharing").innerHTML = s.join("");
}

function shareFooter(orderNum){
	wrt('<style>');
	wrt('a.share	{ background: url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px -152px;}');
	wrt('a.bullBM 	{ background:url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px 4px; }');
	wrt('a.bullFB	{ background:url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px -38px}');
	wrt('a.bullTW	{ background:url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px -18px}');
	wrt('a.bullMS	{ background:url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px -58px}');
	wrt('a.bullDG	{ background:url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px -96px}');
	wrt('a.bullDE	{ background:url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px -119px}');
	wrt('a.bullGO	{ background:url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px -76px}');
	wrt('a.bullEM	{ background:url(http://img.websweeper.com/style/pics/sharing.gif) no-repeat 0px -138px}');
	wrt('</style>');

	wrt('<table align="center" style="padding-top:25px"><tr>');
	wrt('<td rowspan="3" style="margin-right: 6px"><div style="width:78px; height:100px; background: url(http://www.websweeper.com/style/pics/online-orders.png)"><div class="bold center" style="padding:18px 5px 0 0">Over<br/>'+orderNum+'</div></div></td>');
	wrt('<td colspan="5">Outstanding Products, Pricing, &amp; Service from<br />the Professionals at <span class="red bold">A</span>meri-<span class="red bold">B</span>rand <span class="red bold">P</span>roducts <span class="red bold">I</span>nc.</td>');
	wrt('<td rowspan="3" style="padding-left: 10px"><a class="DiggThisButton" /></td>');
	wrt('</tr><tr><td><a href="javascript:createBookmark()">Bookmark</a> | <a onclick="window.open(this.href,\'\',\'toolbar=no,width=350,height=250,resizable=yes,scrollbars=yes\'); return false" href="http://www.websweeper.com/php/refer/ref-form.php?page='+enURL+'" class="bullEM" style="padding-left:22px">Email</a> | Sharing:</td>');
	wrt('<td><a href="http://twitter.com/?status='+enURL+'" style="display: block; width:16px; height:16px;" class="bullTW"></td>')
	wrt('<td><a href="http://facebook.com/share.php?u='+enURL+'" style="display: block; width:16px; height:16px;" class="bullFB"></td>')
	wrt('<td><a href="http://myspace.com/Modules/PostTo/Pages/?u='+enURL+'&amp;t='+enTITLE+'&amp;c='+enDESC+'" style="display: block; width:16px; height:16px;" class="bullMS"></td>')
	wrt('<td><a href="http://delicious.com/save?v=5&noui&jump=close&url='+enURL+'&title='+enTITLE+'" style="display: block; width:16px; height:16px;" class="bullDE"></td>')
	wrt('</tr><tr>');
	wrt('<td colspan="5"><em class="green">Like What You See? Help Us Spread The Word!</em></td></tr></table>');
}

function navTips (){
	window.document.getElementById("navExpand").innerHTML = "<p align='justify'><span class='bold'>T</span>o navigate through this section, or any other part of our web-site, simply use the drop-down menus located on either the left side, right side, or the top of this page. Thank you for visiting us. We look forward to serving you.</p><p align='center'>Respectfully, The Specialists at Ameri-Brand Products Inc.</p><p align='center'>(<a href='' onclick=\"window.document.getElementById('navExpand').innerHTML = ''; return false\">minimize</a>)</p>";
}