		function getBrowseCookieName() {
			return 'ELS_BROWSE_COOKIES_';
		}	
		function readBrowseCookie() {
			return readCookie(getBrowseCookieName());
		}
	
		function readCookie(name) {
			//alert(document.cookie);
			
			var nameEQ = name + "=";
			var ca = document.cookie.split(';');
			for(var i=0;i < ca.length;i++) {
				var c = ca[i];
				//alert(c);
				while (c.charAt(0)==' ') c = c.substring(1,c.length);
					if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
			}
		
			return null;
		}
		
		function createCookie(name,value,minutes) {
			if (minutes) {
				var date = new Date();
				date.setTime(date.getTime()+(minutes*60*1000));
				var expires = "; expires="+date.toGMTString();
			}
			else var expires = "";
			document.cookie = name+"="+value+expires+"; path=/";
		}
		function eraseCookie(name) {
			createCookie(name,"",-1);
		}
		function eraseBrowseCookie() {
			eraseCookie(getBrowseCookieName());
			eraseBrowseRecord();
		}
		
		function recentBrowse(catID, value, imgPath){
			var browseCookie = readCookie(getBrowseCookieName());
			if (imgPath=="undefined" || imgPath== null)
				imgPath = "noimage";
				
			if (browseCookie == null) {
				browseCookie = value + '@' + imgPath + '&';
			} else {
				if (browseCookie.indexOf(value) > -1) {
					var temp = browseCookie.substring(browseCookie.indexOf(value), browseCookie.length);
					temp = temp.substring(temp.indexOf('&')+1, temp.length);
					browseCookie = browseCookie.substring(0, browseCookie.indexOf(value)) + temp;
					browseCookie = value + '@' + imgPath + '&' + browseCookie;
				} else {
					browseCookie = value + '@' + imgPath + '&' + browseCookie;
				}
				//alert(browseCookie);
			}
			if (browseCookie.split('&').length > 8) {
				
				//browseCookie = browseCookie.substring(browseCookie.indexOf('&')+1 , browseCookie.length);
				browseCookie = browseCookie.substring( 0, browseCookie.lastIndexOf('&'));
			}
			eraseCookie(getBrowseCookieName());
			createCookie(getBrowseCookieName(), browseCookie, 1440);			// expires in  30 minutes
			
			// Immediately update flash Movie 
			//updateBrowseRecord();
			
			// redirect to Specific Link
			//window.location = "http://www.google.com/"+ value;
			//window.location = "../../en/product/main.do?method=productDetail&product_id=" + value + "#nav";
			recentCategory(catID, value);
		}
		
		function redirectFromRecentlyView(value) {
			window.location = "../../en/product/main.do?method=productDetail&product_id=" + value + "#nav";
		}
		
		function updateBrowseRecord() {
			if (recentBrowseFlashMovie) {
				recentBrowseFlashMovie.updateBrowseRecord();
			}
		}
		function eraseBrowseRecord() {
			if (recentBrowseFlashMovie) {
				recentBrowseFlashMovie.eraseBrowseRecord();
			}
		}
		
		window.onload = function() {
			init();
		}
		function init() {
			if (document.getElementById) {
				recentBrowseFlashMovie = document.getElementById("recently_fl");
			}
			if (document.getElementById) {
				recentCategoryFlashMovie = document.getElementById("flashCollectionAlbum");
			}
		}
		
		var recentlyViewOpenStatus = false;
		//var swfSigned = false;
		function openRcentlyViewed() {
			var normalObj = document.getElementById("recently_normal");
			var layerObj = document.getElementById("recently_layer");
			var layerImgObj = document.getElementById("recently_img");

			if (recentlyViewOpenStatus) {
				normalObj.style.display = "block";
				layerObj.style.display = "none";
			} else {
				normalObj.style.display = "none";
				layerObj.style.display = "block";
			}
			recentlyViewOpenStatus = !recentlyViewOpenStatus;
		}
		
		
		
			function getCollectionAlbumCookieName() {
			return 'ELS_CATEGORY_COOKIES_';
		}	
		function readCategoryCookie() {
			return readCollectionAlbumCookie(getCollectionAlbumCookieName());
		}
		
		function readCollectionAlbumCookie(name) {
			//alert(document.cookie);
			var nameEQ = name + "=";
			
			var ca = document.cookie.split(';');
			for(var i=0;i < ca.length;i++) {
				var c = ca[i];
				//alert(c);
				while (c.charAt(0)==' ') 
					c = c.substring(1,c.length);
				if (c.indexOf(nameEQ) == 0) 
					return c.substring(nameEQ.length,c.length);
			}
		
			return null;
		}
		
		function createCollectionAlbumCookie(name,value,minutes) {
			if (minutes) {
				var date = new Date();
				date.setTime(date.getTime()+(minutes*60*1000));
				var expires = "; expires="+date.toGMTString();
			}
			else var expires = "";
			document.cookie = name+"="+value+expires+"; path=/";
		}
		function eraseCategoryCookie() {
			createCollectionAlbumCookie(getCollectionAlbumCookieName(),"",-1);
		}
		
		
		function recentCategory(catid, productid) {
			//alert("Length: " + catid.length + " - " + catid[0]);
			// catid_1@catid_2@catid_2@back=yes/no
			var catgeoryCookie = readCollectionAlbumCookie(getCollectionAlbumCookieName());
			if (catid=="undefined" || catid== null)
				catid = "";
				
			//if (catgeoryCookie == null) {
			//	catgeoryCookie = value + '@' + imgPath + '&';
			
			var tempCategory = "";
			for (var i = 0; i < catid.length; i++) {
				tempCategory = tempCategory + catid[i] + '@';
			}
			catgeoryCookie = tempCategory + 'no'  ;		// back - yes/no
			
			eraseCategoryCookie();
			createCollectionAlbumCookie(getCollectionAlbumCookieName(), catgeoryCookie, 30);			// expires in  30 minutes	
			
			// redirect to Specific Link
			//window.location = "../../en/product/main.do?method=productDetail&product_id=" + value + "#nav";
			window.location = "../product/main.do?method=productDetail&product_id="+ productid + "#nav";
			//window.location = "productDetail.html";
		}
		
		function backToCollectionAlbum() {
			window.location = "productcategory.html";
		}
		
		function backToBrandsAndProducts() {
			eraseCategoryCookie();
			window.location = "../BrandsAndProducts/BrandsAndProducts_03.htm";
		}
		
