/***********************************************
* Gradual Highlight image script-  Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var baseopacity=70

function slowhigh(which2){
imgobj=which2
browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
highlighting=setInterval("gradualfade(imgobj)",50)
}

function slowlow(which2){
cleartimer()
instantset(baseopacity)
}

function instantset(degree){
if (browserdetect=="mozilla")
imgobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}


function setCookie (name, value, lifespan, access_path) {
var cookietext = name + "=" + escape(value) 
if (lifespan != null) { 
  var today=new Date() 
  var expiredate = new Date() 
  expiredate.setTime(today.getTime() + 1000*60*60*24*lifespan)
  cookietext += "; expires=" + expiredate.toGMTString()
}
if (access_path != null) { 
  cookietext += "; PATH="+access_path 
}
document.cookie = cookietext 
return null 
}


function setDatedCookie(name, value, expire, access_path) {
var cookietext = name + "=" + escape(value) 
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
if (access_path != null) { 
  cookietext += "; PATH="+access_path 
}
document.cookie = cookietext 
return null 
}


function getCookie(Name) {
var search = Name + "=" 
var CookieString = document.cookie 
var result = null 
if (CookieString.length > 0) { 
    offset = CookieString.indexOf(search) 
    if (offset != -1) { 
        offset += search.length 
        end = CookieString.indexOf(";", offset) 
        if (end == -1) {
           end = CookieString.length }
        result = unescape(CookieString.substring(offset, end)) 
		} 
	}
	return result 
}


function deleteCookie(Name, Path) {
	setCookie(Name,"Deleted", -1, Path)
}

function my_get(id) {
	var tag = null;
	if (document.getElementById) {
		tag = document.getElementById(id);
	} else if (document.all) {
		tag = document.all[id];
	} else if (document.layers) {
		tag = document.layers[id];
	}
	return tag;
}


function show_hide(id) {
	var item = my_get(id);
	if (!item) {
	// do nothing
	} else if (item.style) {
		if (item.style.display == "none") {
			item.style.display = "";
			setCookie ("SH"+id, "show", 365, '/');
		} else {
			item.style.display = "none";
			setCookie ("SH"+id, "hide", 365, '/');			
		}
	} else {
		item.visibility = "show";
	}
}

function showhide(id) {
	var item = my_get(id);
	if (!item) {
	// do nothing
	} else if (item.style) {
		if (item.style.display == "none") {
			item.style.display = "";
		} else {
			item.style.display = "none";
		}
	} else {
		item.visibility = "show";
	}
}


//----------------popup
function popup(winWidth, winHeight, scrollbars,toolbar,top,left,fileSrc) {
	var newParameter = "width=" + winWidth + ",height=" + winHeight ;
	newParameter += ",scrollbars="+scrollbars+",toolbar="+toolbar+",top="+top+",left="+left;
    newWindow = open (fileSrc, "a", newParameter);
}
