function bookmark(){var i = navigator.userAgent.indexOf("Netscape");if(i >= 0){alert("Press Ctrl + D to Bookmark this Page");}
else if (window.sidebar)//firefox{alert("Press Ctrl + D to bookmark");}
else if(window.opera && window.print){//opera var elem = document.createElement('a');elem.setAttribute('href',"http://www.cctvsecuritypros.com");elem.setAttribute('title',document.title);elem.setAttribute('rel','sidebar');elem.click();}
else if(document.all)//ie{window.external.AddFavorite("http://www.cctvsecuritypros.com",'www.cctvsecuritypros.com - '+ document.title);}
else{alert("Press Ctrl + D to Bookmark this page");}
}
//create cookie assigning name, value and expiration days function createCookie1(name,value,days){if (days){var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires ="; expires="+date.toGMTString();}
else var expires ="";document.cookie = name+"="+value+expires+"; path=/";}
//read cookie by name and list value function readCookie(name){var nameEQ = name +"=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++){var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}
return null;}
//delete cookie by name function eraseCookie(name){createCookie1(name,"",-1);}
//######## START switch alt image view ####### function changeImage(img){var imageName;for (i = 1;i <= 9;i++){imageName ="image"+ i;if (document.getElementById(imageName)){document.getElementById(imageName).style.display='none';}
}
document.getElementById(img).style.display='block';}
//######## END switch alt image view #########var name ="recentItems";//cookieName var days = 7;//days before expiration var newString ="";var num = 4;//number of items to display var unique ="yes";//var preCookie = readCookie(name);//append new data to cookie. function setCookie1(){if (!curString) return;var s = curString.replace("^","");if (!preCookie || preCookie ==""){//if cookie does not exist, create it with the current item's data
		newString = curString;
	} else { 
	// If cookie exists, split and compare its content to current item 
		var eachItem = preCookie.split("^");
		for (i = 0; i < num; i++){
			if (eachItem[i] == s ) { 
			unique = "no";
			} 	
		} if (unique == "yes"){
		// if current data is unique, add it to cookie
		  var x = curString + preCookie;
		  var a = x.split("^");	
		  for (i=0;i<num + 1;i++){
		  	newString+=a[i] + "^";
		  }
		  } else {
		// if current data is not unique, do not add it to cookie
		  newString = preCookie;
		  }
	}  
	createCookie1(name,newString,days)
}

//splitting and writing cookie data
function writeRecent(){
	if (preCookie && preCookie != ""){
		var eachItem = preCookie.split("^");
		if (!eachItem || eachItem.length == 0) return;
		var firstElement = eachItem[0].split("|");	
		if (firstElement[0] == prodID && eachItem.length == 2) return;
		var i2 = 0;
    	document.write('<div class="contents-title"id="recentlyviewed">');
    	document.write('<div id="recentItemHeader">Recently Viewed Items</div>');
    	document.write('<table id="recentTable"><tr>');
		
		for (i = 0; i < num || i2 < num; i++){
			//only write item if it exists, is not empty and is unique
			if (eachItem[i] && eachItem[i] != "" && eachItem[i] != "undefined"){
				var eachElement = eachItem[i].split("|");	
				if (eachElement[0] != prodID){
					document.write('<td><div class="mss-itembox-top"><div class="mss-itembox-top2"></div></div></td><td rowspan="3"class="divider"><br/></td>');
					i2 = i2 + 1; 
				}
			}else { i2 = i; }
		}
		document.write('</tr>');
		
		i2 = 0;
		for (i = 0; i < num || i2 < num; i++){
			//only write item if it exists, is not empty and is unique
			if (eachItem[i] && eachItem[i] != "" && eachItem[i] != "undefined"){
				var eachElement = eachItem[i].split("|");	
				if (eachElement[0] != prodID){
					document.write('<td><div id="recentItem' + i2 + '"' + 'class="recentItem">');
					document.write('<div class="recentImg"><a href="' + eachElement[0] + '.html"><img src="' + eachElement[1] + '"border="0"/></a></div>');
					document.write('<div class="recentName"><a href="' + eachElement[0] + '.html">' + eachElement[2] + '</a></div>');
					if (eachElement[3] && eachElement[3] != ""){
						document.write('<div class="recentPrice">Regular Price:' + eachElement[3] + '</div>');
						}
					if (eachElement[4] && eachElement[4] != ""){
						document.write('<div class="recentSprice"><span>Sale Price:</span>' + eachElement[4] + '</div>');
						}
					document.write('</div></td>');
					i2 = i2 + 1; 
				}
			} else { i2 = i; } // don't increment counter is the current page is already displayed}
document.write('</tr><tr>');i2 = 0;for (i = 0;i < num || i2 < num;i++){//only write item if it exists, is not empty and is unique if (eachItem[i]&& eachItem[i]!=""&& eachItem[i]!="undefined"){var eachElement = eachItem[i].split("|");if (eachElement[0]!= prodID){document.write('<td><div class="mss-itembox-btm"><div class="mss-itembox-btm2"></div></div></td>');}
}
else{i2 = i;}
}
document.write('</tr>');document.write('</tr></table></div>');}
}
function domticker(content, divId, divClass, delay, fadeornot){this.content=content this.tickerid=divId//ID of master ticker div. Message is contained inside first child of ticker div this.delay=delay//Delay between msg change, in miliseconds. this.mouseoverBol=0//Boolean to indicate whether mouse is currently over ticker (and pause it if it is) this.pointer=1 this.opacitystring=(typeof fadeornot!="undefined")?"width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1":""if (this.opacitystring!="") this.delay+=500//add 1/2 sec to account for fade effect, if enabled this.opacitysetting=0.2//Opacity value when reset. Internal use. document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'">'+content[0]+'</div></div>') var instanceOfTicker=this setTimeout(function(){instanceOfTicker.initialize()}
, delay)}
domticker.prototype.initialize=function(){var instanceOfTicker=this this.contentdiv=document.getElementById(this.tickerid).firstChild//div of inner content that holds the messages document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()}
domticker.prototype.rotatemsg=function(){var instanceOfTicker=this if (this.mouseoverBol==1)//if mouse is currently over ticker, do nothing (pause it) setTimeout(function(){instanceOfTicker.rotatemsg()}
, 100) else{this.fadetransition("reset")//FADE EFFECT- RESET OPACITY this.contentdiv.innerHTML=this.content[this.pointer]this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up','fadetimer1')}
, 100)//FADE EFFECT- PLAY IT this.pointer=(this.pointer=1) clearInterval(this[timerid])}
//bookmark function mssBookmark(bmurl,title){if ((navigator.appName =="Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)){window.external.AddFavorite(bmurl,title);}
else if (navigator.appName =="Netscape"){window.sidebar.addPanel(title,bmurl,"");}
else{alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");}
return false;}
//create cookie assigning name, value and expiration days function createCookie1(name,value,days){if (days){var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires ="; expires="+date.toGMTString();}
else var expires ="";document.cookie = name+"="+value+expires+"; path=/";}
//read cookie by name and list value function readCookie(name){var nameEQ = name +"=";var ca = document.cookie.split(';');for(var i=0;i < ca.length;i++){var c = ca[i];while (c.charAt(0)==' ') c = c.substring(1,c.length);if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}
return null;}
//delete cookie by name function eraseCookie(name){createCookie1(name,"",-1);}

