/* MindDog.cn */



/* getCookie(), setCookie(), deleteCookie() */
		
		function getCookie(CookieName) {
			var start = document.cookie.indexOf(CookieName + '=');
			var len = start + CookieName.length + 1;
			if ((!start) && (CookieName != document.cookie.substring(0,CookieName.length)))
				return null;
			if (start == -1)
				return null;
			var end = document.cookie.indexOf(';',len);
			if (end == -1) end = document.cookie.length;
				return unescape(document.cookie.substring(len,end));
		}

		function setCookie(CookieName,value,expires,path,domain,secure) {
			document.cookie = CookieName + "=" +escape(value) +
			( (expires) ? ";expires=" + expires : "") +
			( (path) ? ";path=" + path : "") + 
			( (domain) ? ";domain=" + domain : "") +
			( (secure) ? ";secure" : "");
		}

		function deleteCookie(CookieName,path,domain) {
			if (getCookie(CookieName))
				document.cookie =
				CookieName + '=' +
				( (path) ? ';path=' + path : '') +
				( (domain) ? ';domain=' + domain : '') +
				';expires=Thu, 01-Jan-1970 00:00:01 GMT';
		}

/* setLinkAttributes() */
		
		function setLinkAttributes(switchLinks) {
			if (switchLinks == "true") {
				if (!document.getElementsByTagName) return;
				var anchors = document.getElementsByTagName("a");
					for (var i=0; i<anchors.length; i++) {
					var anchor = anchors[i];
					
					if (anchor.getAttribute("href") && ( anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "nofollow" ) ) {
						anchor.target = "_blank";
					}
				}
			} else {
				if (!document.getElementsByTagName) return;
				var anchors = document.getElementsByTagName("a");
					for (var i=0; i<anchors.length; i++) {
					var anchor = anchors[i];
					
					if (anchor.getAttribute("href") && ( anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "nofollow" ) ) {
						anchor.target = "_self";
					}
				}
			}
		}
		
		function toggleLinkAttributes() {
			var ExpireLongTerm = new Date();
			var ExpireLongTermValue = new Date(ExpireLongTerm.getTime()+(1000 * 60 * 60 * 360000));

			var check_tag = document.getElementById('toggleLinks');
			if ( check_tag.checked == true )
			{
				setLinkAttributes("false");
				setCookie("externalLinks","true",ExpireLongTermValue,"/",".pchome.net");
			} else {
				setLinkAttributes("true");
				deleteCookie("externalLinks","/",".pchome.net");
			}
		}	
