window.focus();

function np(url) {
	window.location.href = url;
}

// open status window
function nw_status(url) {
	window.open(url,'status','toolbar=0,location=0,status=0,scrollbars=1,resizable=0,width=450,height=450');
}

// ---------------------------- Nickpage

// guestbook - check all entries
function checkAll(field) {
  	for (var i=0;i<field.length;i++) {
    	var e = field[i];
      	e.checked = field.allbox.checked;
	}
}

// ---------------------------- MM gallery

// post comment
function post_comment() {
	var commentlayer = document.getElementById('post_comment');
	if (commentlayer.style.display == "none") {
		commentlayer.style.display = "block";
	} else {
		commentlayer.style.display = "none";
	}
}

// delete items - warning
function ask_for_deletion() {
	window.open("/h/int/Nickpage/Gallery/delete_warning.html", 'delete','scrollbars=0,status=0,width=300,height=110');
}
// delete items
function delete_photos() {
	document.frm.target = '_self';
	document.frm.a.value = 'del';
	document.frm.submit();
}

// page sorting
function display_page(new_page) {
	// set prev next numbers
	document.getElementById("prev_next").style.display = (pagecount == 1) ? 'none' : 'block';
	document.getElementById("actualpage").innerHTML= "<b>" + new_page + "</b>" + " / " + pagecount;
	document.getElementById("prev_next_down").style.display = (pagecount == 1) ? 'none' : 'block';
	document.getElementById("actualpage_down").innerHTML= "<b>" + new_page + "</b>" + " / " + pagecount;
	// set prev next buttons
    document.getElementById("prev_button").style.display = (new_page == 1) ? 'none' : 'block';
    document.getElementById("next_button").style.display = (new_page == pagecount) ? 'none' : 'block';
	document.getElementById("prev_button_down").style.display = (new_page == 1) ? 'none' : 'block';
    document.getElementById("next_button_down").style.display = (new_page == pagecount) ? 'none' : 'block';
	// set page
	document.getElementById("page" + current_page).style.display = 'none';
	document.getElementById("page" + new_page).style.display = 'block';
	current_page = new_page;
}

function change_page(page_diff) {
    display_page(current_page + page_diff);
	// reset selected checkboxes & mark-all checkbox
	frm.allbox.checked = false;
	checkItems(document.frm,current_page);
}

// MM folderview - check all entries
function checkItems(field,page) {
  	for (var i=0;i<field.length;i++) {
    	var e = field[i];
		t = e.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.id; /* FLS wieso? */
      	if (t == ("page" + page )) {
			e.checked = frm.allbox.checked;
		}
	}
}

// insert tags from tagdropdown to tag-field
function insert_tags(taglist, target) {
	var tagdropdown = taglist.options[taglist.selectedIndex].value;
	if (!tagdropdown) return;
		var comma = "";
	if (target) {
		comma = ", ";
	}
	document.frm.tags.value = target + comma + tagdropdown;
}

// ---------------------------- MM gallery

function trackback(url) {
	window.open("/h/int/Nickpage/Weblog/trackback.html?" + url,'trackback','toolbar=0,location=0,status=0,scrollbars=1,resizable=0,width=598,height=120');
}
function permalink(url) {
	window.open("/h/int/Nickpage/Weblog/permalink.html?" +url,'perma','toolbar=0,location=0,status=0,scrollbars=1,resizable=0,width=598,height=120');
}

// ---------------------------- info layer
function info(layer_id) {
	document.getElementById(layer_id).style.display = 'block';
}
function reset_info(layer_id) {
	document.getElementById(layer_id).style.display = 'none';
}

// ---------------------------- i message (self admin ad delivery)

var selfAdminAdReq;

function evalScriptTagsInHtml(html) {
   var start = html.indexOf('<script');
   var end = -1;
   while (start >= 0) {
      start = html.indexOf('>', start);
      end = html.indexOf('</script>', start);
      if (end > start) {
         var script = html.substr(start + 1, end - start - 1);
         eval(script);
         start = html.indexOf('<script', end);
      } else {
         start = -1;
      }
   }
}

function processReqChange() {
    if (selfAdminAdReq.readyState == 4) {
        if (selfAdminAdReq.status == 200) {
            document.getElementById('imessage').innerHTML = selfAdminAdReq.responseText;
            evalScriptTagsInHtml(selfAdminAdReq.responseText);
        }
    }
}

function loadXMLDoc(url) {
     selfAdminAdReq = false;
     if(window.XMLHttpRequest) {
          try { selfAdminAdReq = new XMLHttpRequest(); }
          catch(e) { selfAdminAdReq = false; }
     } else if(window.ActiveXObject) {
          try { selfAdminAdReq = new ActiveXObject("Msxml2.XMLHTTP"); }
          catch(e) {
              try { selfAdminAdReq = new ActiveXObject("Microsoft.XMLHTTP"); }
              catch(e) { selfAdminAdReq = false; }
          }
     }
     if(selfAdminAdReq) {
          selfAdminAdReq.onreadystatechange = processReqChange;
          selfAdminAdReq.open("GET", url, true);
          selfAdminAdReq.send("");
     }
}

function poplulateSelfAdminAdBox() {
    loadXMLDoc("/cgi-bin/self-admin-ad-view.fcgi");
}


function aezpskin_sky() {}

function sponsoring() {


   // insert sponsoring logo for pokkerrom
   //var pokerroom = "<a href='http://www.uboot.com/cgi-bin/cms-track-link-and-redirect.fcgi?link_in_content_id=795925566' target='_blank'><img src='/i/int/np/skin_24/pokerroom_logo.gif' alt='' border='0' width='138' height='48' style='margin-bottom:10px;'></a>";
   //if (skin_id == "24") {
   //   document.write (pokerroom);
   //}


   // insert sponsoring logo for pokkerrom
   var oelz = "<img src='http://www.uboot.com/cgi-bin/cms-view-tracking-pixel.fcgi?content_id=1483538310' width='1' height='1' alt=''>";
   if (skin_id == "45") {
      document.write (oelz);
   }




// insert player for nokia_skin_27
//	var nokia = "<a href='http://sel.as-eu.falkag.net/sel?cmd=lnk&kid=362697&bid=1276942&dat=720407&opt=0&rdm' target='_blank'><img src='/i/int/np/skin_25/mentos_logo.gif' alt='' border='0' width='150' height='61' style='margin-bottom:10px;'></a><img src='http://as1.falkag.de/sel?cmd=ban&kid=362697&dat=720407&opt=0&rdm=0' width=1 height=1 border=0>";
//	if (skin_id == "27") {
//	document.write("<OBJECT classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='160' height='132' id='playa_nokia3' align='middle'>")
 //  document.write("<PARAM NAME=wmode VALUE='transparent'>")
   // document.write("<PARAM NAME=movie VALUE='http://www.uboot.com/i/int/np/skin_28/player/playa_nokia3.swf?xmllist=http://www.uboot.com/i/int/np/skin_28/player/songlist.xml'>")
//    document.write("<PARAM NAME=quality VALUE=high>")
 //   document.write("<PARAM NAME=bgcolor VALUE='#000000'>")
  //  document.write("<param name='FlashVars' value='clickTag=http://vodafone.de/&amp;clicktarget=_blank'>")
//    document.write("<EMBED src='http://www.uboot.com/i/int/np/skin_28/player/playa_nokia3.swf?xmllist=http://www.uboot.com/i/int/np/skin_28/player/songlist.xml' wmode='transparent' quality='high' bgcolor='#000000' width='160' height='132' name='playa_nokia3' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' >")
//    document.write("</OBJECT>")
//    document.write("<br>")
//     document.write("<br>")
//      document.write("<br>");

//	}



}




// ajax request object
function xml_request() {
    try {
       return  new XMLHttpRequest();
    } catch(e) {
       try {
          return new ActiveXObject("Msxml2.XMLHTTP");
       } catch(e) {
          return new ActiveXObject("Microsoft.XMLHTTP");
       }
    }
}

//confirmation box for delete links
function areYouSure(message) {
	return confirm(message);
}

//detect the browser and return an array. 0=name, 1=version
function detectBrowser() {
    var brVer = navigator.userAgent;
    var reg = new RegExp('/');
    var brNum;

    if (navigator.appName == 'Microsoft Internet Explorer') {
       var brVerId = brVer.indexOf('MSIE');
       brNum = brVer.substr(brVerId+5,3);
       return Array(navigator.appName,brNum);
    } else {
       var brVerId = brVer.search(reg);
       brNum = brVer.substring(brVerId+1);
       return Array(navigator.appName,brNum);
    }
}

//add to bookmark
function bookmark(title) {
    if (window.sidebar) //firefox
        window.sidebar.addPanel(title, location.href, "");
    else if(window.opera && window.print) { //opera
        var elem = document.createElement('a');
        elem.setAttribute('href',location.href);
        elem.setAttribute('title',title);
        elem.setAttribute('rel','sidebar');
        elem.click();
    }
    else if(document.all) //internet explorer
        window.external.AddFavorite(location.href,title);
}