var div_opacity = 0;
var opacity_layer = null;
var req = null;
var opacity_timer = null;
var frame_height = 0;
var frame_width = 0;
var dir = '';
var show_hr_link = false;
var pic_id_list = null;
function rating_received_data(id) {
switch(req.readyState) {
case 4:
if (req.status == 200) {
alert('Vielen Dank für Deine Stimme!');
picture_load('gallery', id);
}
break;
default:
return false;
break;
}
}
function rating_stars_move(evt) {
var pointer_x = null;
if (typeof evt.x == 'number') pointer_x = evt.x;
else if (typeof evt.layerX == 'number') pointer_x = evt.layerX;
if (pointer_x != null) document.getElementById('rating_star_m').style.width = pointer_x + 'px';
}
function do_rating(evt, id, width) {
var pointer_x = null;
if (typeof evt.x == 'number') pointer_x = evt.x;
else if (typeof evt.layerX == 'number') pointer_x = evt.layerX;
if (pointer_x != null) {
var cookies = document.cookie;
if (cookies.indexOf('xperts_fanart_' + id + '=') == -1) {
var points = (pointer_x / width * 5)
points = Math.round(points);
var reply = confirm("Willst Du das Bild mit " + points + " Stern" + ((points == 1) ? "" : "en") + " bewerten?");
if (reply) {
try {
req = new XMLHttpRequest();
}
catch(ms) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(nonms) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(failed) {
req = null;
}
}
}
if (req != null) {
req.open("GET", '/ajax.php?action=picture_rating&id=' + id + '&points=' + points, true);
req.setRequestHeader("Pragma", "no-cache");
req.setRequestHeader("Cache-Control", "must-revalidate");
req.setRequestHeader("If-Modified-Since", document.lastModified);
req.onreadystatechange = new Function('rating_received_data(' + id + ')');
req.send(null);
}
else {
alert('Ein Fehler ist aufgetreten. Bitte überprüfe, ob Du einen aktuellen Browser verwendest.');
}
}
}
else {
alert('Du hast dieses Bild bereits bewertet!');
}
}
}
function picture_info_received_data() {
switch(req.readyState) {
case 4:
if (req.status == 200) {
if (req.responseText != "") {
var pic_info_string = req.responseText;
var pic_info = pic_info_string.split('\n');
type = pic_info[0];
document.getElementById('picture_frame_description').innerHTML = pic_info[2];
var is_gallery = false;
if ((type == 'news') && (pic_id_list != null)) {
var id_array = pic_id_list.split(',');
var id_list = ',' + pic_id_list + ',';
var pos = id_list.indexOf(',' + pic_info[1] + ',');
id_list = id_list.slice(0, pos);
pos = id_list.replace(/\d/g, '').length;
count = id_array.length;
id_next = id_array[pos + 1];
id_previous = id_array[pos - 1];
is_gallery = true;
}
else if (type == 'gallery') {
if (pic_info[9] != '') document.getElementById('picture_frame_description').innerHTML = document.getElementById('picture_frame_description').innerHTML + '
' + pic_info[9] + '';
if (pic_info[8] != '') document.getElementById('picture_frame_description').innerHTML = document.getElementById('picture_frame_description').innerHTML + '
Quelle: ' + pic_info[8] + '';
id_next = pic_info[6];
id_previous = pic_info[7];
if (id_previous == '') pos = 0; else pos = 1;
if (id_next == '') count = pos + 1; else count = 0;
if (pic_info[10] == '1') {
var rating = '
';
document.getElementById('picture_frame_description').innerHTML = document.getElementById('picture_frame_description').innerHTML + rating;
}
is_gallery = true;
}
if ((!is_gallery) || (pos == 0)) {
document.getElementById('div_picture_frame_previous').style.visibility = 'hidden';
}
else {
document.getElementById('div_picture_frame_previous').style.visibility = '';
document.getElementById('picture_previous_link').href = "javascript:void(picture_load('" + type + "', " + id_previous + "))";
}
if ((!is_gallery) || (pos == (count - 1))) {
document.getElementById('div_picture_frame_next').style.visibility = 'hidden';
}
else {
document.getElementById('div_picture_frame_next').style.visibility = '';
document.getElementById('picture_next_link').href = "javascript:void(picture_load('" + type + "', " + id_next + "))";
}
if ((document.getElementById('picture_frame_description').innerHTML == '') && ((document.getElementById('div_picture_frame_previous').style.visibility == '') || (document.getElementById('div_picture_frame_next').style.visibility == ''))) document.getElementById('picture_frame_description').innerHTML = ' ';
picture_show(dir + pic_info[1] + pic_info[3], pic_info[4], pic_info[5]);
}
}
break;
default:
return false;
break;
}
}
function picture_load(type, id) {
try {
req = new XMLHttpRequest();
}
catch(ms) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(nonms) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(failed) {
req = null;
}
}
}
if (req != null) {
req.open("GET", '/ajax.php?action=g_picture_info&type=' + type + '&id=' + id, true);
req.setRequestHeader("Pragma", "no-cache");
req.setRequestHeader("Cache-Control", "must-revalidate");
req.setRequestHeader("If-Modified-Since", document.lastModified);
req.onreadystatechange = picture_info_received_data;
req.send(null);
return true;
}
else {
return false;
}
}
function pic_add_opacity_layer() {
if (opacity_layer == null) {
opacity_layer = document.createElement('div');
opacity_layer.style.zIndex = 99;
opacity_layer.style.filter = 'Alpha(opacity = 0)';
opacity_layer.style.position = 'absolute';
opacity_layer.style.top = '0px';
opacity_layer.style.left = '0px';
opacity_layer.style.width = '100%';
opacity_layer.style.height = document.documentElement.scrollHeight + 'px';
opacity_layer.style.minHeight = '100%';
opacity_layer.style.backgroundColor = '#000000';
opacity_layer.style.overflow = 'hidden';
opacity_layer.style.opacity = 0;
opacity_layer.onclick = closePictureFrame;
document.getElementsByTagName('body')[0].appendChild(opacity_layer);
}
else {
document.getElementsByTagName('body')[0].removeChild(opacity_layer);
opacity_layer = null;
}
}
function pic_change_opacity(factor) {
div_opacity = div_opacity + (factor * 5);
if ((div_opacity >= 0) && ((div_opacity <= 70))) {
opacity_layer.style.opacity = (div_opacity / 100);
opacity_layer.style.filter = 'Alpha(opacity = ' + div_opacity + ')';
window.clearTimeout(opacity_timer);
opacity_timer = window.setTimeout("pic_change_opacity(" + factor + ")", 10);
}
else {
div_opacity = div_opacity - (factor * 5);
if (factor == -1) pic_add_opacity_layer();
}
}
function picture_show(file, width, height) {
var margin_height = document.getElementById('picture_frame_description').offsetHeight + 45;
if ((width <= (frame_width - 10)) && (height <= (frame_height - margin_height))) {
var picture_width = width;
var picture_height = height;
show_hr_link = false;
}
else {
var aspect_ratio = (width / height);
if (((frame_width - 10) / (frame_height - margin_height)) > aspect_ratio) {
var picture_height = (frame_height - margin_height);
var picture_width = (picture_height * aspect_ratio);
}
else {
var picture_width = (frame_width - 10);
var picture_height = (picture_width / aspect_ratio);
}
show_hr_link = true;
}
document.getElementById('div_picture_img').style.marginTop = ((frame_height - margin_height - picture_height) / 2) + 'px';
document.getElementById('div_picture_img').style.height = picture_height + 'px';
document.getElementById('div_picture_img').style.width = picture_width + 'px';
document.getElementById('picture_hr_link').style.display = 'none';
document.getElementById('img_picture').style.display = 'none';
document.getElementById('img_picture').style.width = picture_width + 'px';
document.getElementById('img_picture').style.height = picture_height + 'px';
document.getElementById('img_picture').src = file;
document.getElementById('picture_hr_link').href = file;
}
function openPictureFrame(idir, width, height) {
pic_add_opacity_layer();
if (opacity_layer == null) {
return false;
}
else {
frame_height = 500;
frame_width = 700;
if (window.innerHeight) {
var screen_height = window.innerHeight;
var screen_width = window.innerWidth;
}
else if (document.documentElement.clientHeight) {
var screen_height = document.documentElement.clientHeight;
var screen_width = document.documentElement.clientWidth;
}
else if ((document.body) && (document.body.offsetHeight)) {
var screen_height = document.body.offsetHeight;
var screen_width = document.body.offsetWidth;
}
if (screen_width < frame_width) frame_width = screen_width - 50;
if (screen_height < frame_height) frame_height = screen_height - 50;
document.getElementsByTagName('body')[0].appendChild(document.getElementById('div_picture'));
document.getElementById('div_picture').style.top = ((screen_height - frame_height) / 2) + 'px';
document.getElementById('div_picture').style.left = ((screen_width - frame_width) / 2) + 'px';
document.getElementById('div_picture').style.height = frame_height + 'px';
document.getElementById('div_picture').style.width = frame_width + 'px';
document.getElementById('div_picture').style.display = '';
document.getElementById('div_picture_content').style.height = (frame_height - 30) + 'px';
document.getElementById('div_picture_frame_description').style.width = (frame_width) + 'px';
window.clearTimeout(opacity_timer);
opacity_timer = window.setTimeout("pic_change_opacity(1)", 10);
return true;
}
}
function closePictureFrame() {
document.getElementById('div_picture').style.display = 'none';
document.getElementById('div_picture_img').style.backgroundImage = "url('/images/loader.gif')";
document.getElementById('picture_frame_description').innerHTML = ' ';
document.getElementById('div_picture_frame_previous').style.visibility = 'hidden';
document.getElementById('div_picture_frame_next').style.visibility = 'hidden';
window.clearTimeout(opacity_timer);
opacity_timer = window.setTimeout("pic_change_opacity(-1)", 10);
}
function openNewsPicture(idir, id, extension, width, height, id_list) {
pic_id_list = id_list;
dir = idir;
if (openPictureFrame(width, height)) {
picture_show(dir + id + extension, width, height);
picture_load('news', id);
return false;
}
else return true;
}
function openGalleryPicture(idir, id, extension, width, height) {
dir = idir;
if (openPictureFrame(width, height)) {
picture_show(dir + id + extension, width, height);
picture_load('gallery', id);
return false;
}
else return true;
}
function openURLPicture(file, width, height, description) {
if (openPictureFrame(width, height)) {
if (description != undefined) document.getElementById('picture_frame_description').innerHTML = description;
picture_show(file, width, height);
return false;
}
else return true;
}
function img_load_finish() {
document.getElementById('img_picture').style.display = '';
if (show_hr_link) document.getElementById('picture_hr_link').style.display = '';
}
function openPopup2(url, height, width) {
window.open(url,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=50,top=50,height=' + height + ',width=' + width);
}
function openPopup(url, height, width, scrollbars) {
var scroll = scrollbars;
var resize = "no";
var newwidth = width;
var newheight = height;
if(screen.width < width) {
var newwidth = (screen.width-100);
var left = 50;
var scroll = "yes";
var resize = "yes";
}
else {
var left = (screen.width - width)/2;
}
if(screen.height - 100 < height) {
var newheight = (screen.height-100);
var scroll = "yes";
var resize = "yes";
}
Options = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable="+resize+",left="+left+",top=50,height="+newheight+",width="+newwidth;
newWindow = window.open(url,"",Options);
}
function openPicture(url,imagewidth,imageheight) {
var scroll = "no";
var resize = "no";
var newwidth = imagewidth;
var newheight = imageheight;
if(screen.width < imagewidth) {
var newwidth = (screen.width-100);
var left = 50;
var scroll = "yes";
var resize = "yes";
}
else {
var left = (screen.width - imagewidth)/2;
}
if(screen.height < imageheight) {
var newheight = (screen.height-100);
var top = 50;
var scroll = "yes";
var resize = "yes";
}
else {
var top = (screen.height - imageheight)/2;
}
Options = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable="+resize+",left="+left+",top="+top+",height="+newheight+",width="+newwidth;
newPictureWindow = window.open("","",Options)
with(newPictureWindow) {
document.writeln('Harry Potter Xperts - www.harrypotter-xperts.de');
document.writeln('');
document.writeln('');
document.writeln('')
}
}
function openWallpaper(src,size)
{
var breite = 800;
var hoehe = 600;
switch(size)
{
case "800 x 600":
breite = 800;
hoehe = 600;
break;
case "1024 x 768":
breite = 1024;
hoehe = 768;
break;
case "1280 x 1024":
breite = 1280;
hoehe = 1024;
break;
}
var newwin = openWallpaperPopup('',breite,hoehe);
newwin.document.write( '');
newwin.document.write( '');
newwin.document.write( 'Harry Potter Xperts Wallpaper');
newwin.document.write( '');
newwin.document.write( '');
newwin.document.write( '');
newwin.document.write( '');
newwin.document.write( '');
}
function openWallpaperPopup(url,breite,hoehe)
{
var a = Math.round(Math.random() * 1000);
var newwin;
newwin = window.open(url,a,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+ breite +',height='+ hoehe +',top='+ (( screen.height - hoehe )/2) +',left='+ (( screen.width - breite )/2) );
return newwin;
}
function openVideo(id, type, duration, width, height) {
document.getElementById('divPlayer').innerHTML = '';
}