// Insert frames if document lost frames
homeframe = "";
hometarget = "";

function checkFrames() {
	if(!top.frames[0] && homeframe!="") {
		document.cookie = "lostPage=" + escape(window.location.href) + "*" + hometarget;
		location.href = homeframe;
	}
}

function checkLost() {
	info = getCookie();
	if (info != null) {
		pageUrl = info.substring(0,info.indexOf("*"));
		framename = info.substring(info.indexOf("*")+1,info.length);
		eval("self." + framename + ".location.href = pageUrl;");
		delCookie();
	}	
}

function getCookie(){
  var cookieName = "lostPage=";               
  var doc_cookie = document.cookie;             
  if (doc_cookie.length > 0) {              
    begin = doc_cookie.indexOf(cookieName);       
    if (begin != -1) {           
      begin += cookieName.length;       
      end = doc_cookie.indexOf(";", begin);
      if (end == -1) end = doc_cookie.length;
        return unescape(doc_cookie.substring(begin, end));
    } 
  }
  return null;
}

function delCookie() {
    document.cookie = "lostPage=; expires=Thu, 01-Jan-70 00:00:01 GMT";
}