function setBookmark(url,str){
if(str=='')str=url;
if (document.all)window.external.AddFavorite(url,str);
else alert('Press CTRL and D to add a bookmark to:\n"'+url+'".');
} 

function clearDefault(entry) {
  if (entry.defaultValue==entry.value) entry.value = ""
}

function resetDefault(entry, def) {
	if (entry.defaultValue=="") entry.value=def
}


function getCookie(NameOfCookie)
{

// First we check to see if there is a cookie stored.
// Otherwise the length of document.cookie would be zero.

if (document.cookie.length > 0) 
{ 

// Second we check to see if the cookie's name is stored in the
// "document.cookie" object for the page.

// Since more than one cookie can be set on a
// single page it is possible that our cookie
// is not present, even though the "document.cookie" object
// is not just an empty text.
// If our cookie name is not present the value -1 is stored
// in the variable called "begin".

begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) // Note: != means "is not equal to"
{ 

// Our cookie was set. 
// The value stored in the cookie is returned from the function.

begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 

// Our cookie was not set. 
// The value "null" is returned from the function.

}

function setCookie(NameOfCookie, value, expiredays) 
{

// Three variables are used to set the new cookie. 
// The name of the cookie, the value to be stored,
// and finally the number of days until the cookie expires.
// The first lines in the function convert 
// the number of days to a valid date.

var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

// The next line stores the cookie, simply by assigning 
// the values to the "document.cookie" object.
// Note the date is converted to Greenwich Mean time using
// the "toGMTstring()" function.

document.cookie = NameOfCookie + "=" + escape(value) + 
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function showSurvey(winurl,ttl,body,url,pathprefix)
{
var win = window.open(winurl,'Survey','location=yes,resizable=yes,scrollbars=yes,status=yes,width=250,height=250,top=250,left=300');
  win.document.write('<html><head><title>Survey</title>');
  win.document.write('<link rel="stylesheet" href="'+pathprefix+'/css/popup.css">');
  win.document.write('</head><body>');
  win.document.write('<br /><p id="surveyTtl">'+ttl+'</p><div id="surveyBody"><img src="'+pathprefix+'/images/opinion_icon.gif" /><p id="surveyBodyTxt">'+body+'</p></div><div class="surveyBtn"><img border="0" src="'+pathprefix+'/images/survey_btn.gif" onclick="window.resizeTo(640,480);document.location.href=\''+url+'\'" style="cursor:pointer;" /></div>');
  win.document.write('</body></html>');
  win.document.close();




try
{
win.focus();
}
catch(e){}
}


function openSurveyPopup(winurl,ttl,body,url,pathprefix,channelId){
	var cookieDate = new Date ();
	if(getCookie("SurveyCookie_"+channelId) == null){
		showSurvey(winurl,ttl,body,url,pathprefix);
	    setCookie("SurveyCookie_"+channelId, cookieDate, 15);
	}
}

function openSurveyPopupWithDelay(winurl,ttl,body,url,delay,pathprefix,channelId){
	setTimeout(function(){openSurveyPopup(winurl,ttl,body,url,pathprefix,channelId)},delay);

}

