function getProgress(uid) {
   if(HttpRequestObject) {
      HttpRequestObject.open('GET', 'getprogress.php?uid=' + uid, true);
      HttpRequestObject.onreadystatechange = function() {
         if(HttpRequestObject.readyState == 4 && HttpRequestObject.status == 200) {
            var progress = HttpRequestObject.responseText;
            document.getElementById('pb_inner').style.width = progress + '%';
            document.getElementById('pb_inner').innerHTML = progress + '%';
            if(progress < 100) {
               setTimeout('getProgress("' + uid + '")', 100);
            }
            else {
               document.getElementById('pb_inner').innerHTML = 'Upload Complete!';
            }
         }
      }
      HttpRequestObject.send(null);
   }
}

function startProgress(uid) {
   document.getElementById('upload').style.display = 'none';
   document.getElementById('pb_outer').style.display = 'block';
   setTimeout('getProgress("' + uid + '")', 1000);
}

	function ajax(uid) {
		var req;
	 	try {
			req = window.XMLHttpRequest?new XMLHttpRequest(): 
				new ActiveXObject("Microsoft.XMLHTTP"); 
		} catch (e) {
			//Kein AJAX Support
		}
 
		req.onreadystatechange = function() {
			if ((req.readyState == 4) && (req.status == 200)) { 
				document.getElementById("status").innerHTML = req.responseText;
			}
		}
		req.open('GET', 'status.php?uid='+uid);
		req.send(null);
	}

/*
var message="© meine-photos.de";
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
*/



function opendetailwindow() { 

window.open('','detailwindow','toolbar=no,scrollbars=yes,resizable=no,width=680,height=480');

}

function popup(mylink, windowname)

{

if (! window.focus)return true;

var href;

if (typeof(mylink) == 'string')

href=mylink;

else

href=mylink.href;

window.open(href, windowname, 'width=170,height=300,scrollbars=no');

return false;

} 

var smiletagURL = "http://www.meine-photos.de/smiletag/";

var statusWin, toppos, leftpos;

toppos = (screen.height - 401)/2;

leftpos = (screen.width - 401)/2;

function showProgress() 
{
statusWin = window.open("./progress.php","Status","height=150,width=350,top="+toppos+",left="+leftpos+",location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes");

      statusWin.focus();
	  
}
	
function hideProgress() 

{

if (statusWin != null) 

{

if (!statusWin.closed) 

{

statusWin.close();

}}}


function getarraysize(thearray) {
  for (i = 0; i < thearray.length; i++) {
    if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null)) {
      return i;
    }
  }
  return thearray.length;
}

function arraypush(thearray,value) {
  thearraysize = getarraysize(thearray);
  thearray[thearraysize] = value;
}

function arraypop(thearray) {
  thearraysize = getarraysize(thearray);
  retval = thearray[thearraysize - 1];
  delete thearray[thearraysize - 1];
  return retval;
}

function bbcode(theform,bbcode,prompttext) {
  inserttext = prompt(tag_prompt+"\n["+bbcode+"]xxx[/"+bbcode+"]",prompttext);
  if ((inserttext != null) && (inserttext != "")) {
    theform.comment_text.value += "["+bbcode+"]"+inserttext+"[/"+bbcode+"] ";
    theform.comment_text.focus();
  }
}

function namedlink(theform,thetype) {
  linktext = prompt(link_text_prompt,"");
  var prompttext;
  if (thetype == "URL") {
    prompt_text = link_url_prompt;
    prompt_contents = "http://";
  }
  else {
    prompt_text = link_email_prompt;
    prompt_contents = "";
  }
  linkurl = prompt(prompt_text,prompt_contents);
  if ((linkurl != null) && (linkurl != "")) {
    if ((linktext != null) && (linktext != "")) {
      theform.comment_text.value += "["+thetype+"="+linkurl+"]"+linktext+"[/"+thetype+"] ";
    }
    else {
      theform.comment_text.value += "["+thetype+"]"+linkurl+"[/"+thetype+"] ";
    }
  }
  theform.comment_text.focus();
}

function dolist(theform) {
  listtype = prompt(list_type_prompt, "");
  if ((listtype == "a") || (listtype == "1")) {
    thelist = "[list="+listtype+"]\n";
    listend = "[/list="+listtype+"] ";
  }
  else {
    thelist = "[list]\n";
    listend = "[/list] ";
  }
  listentry = "initial";
  while ((listentry != "") && (listentry != null)) {
    listentry = prompt(list_item_prompt, "");
    if ((listentry != "") && (listentry != null)) {
      thelist = thelist+"[*]"+listentry+"\n";
    }
  }
  theform.comment_text.value += thelist+listend;
  theform.comment_text.focus();
}
/*
f = escape(document.URL); 
g= escape(document.referrer);
r="&seite=";
document.write("<img src='http://www.meine-photos.de/counter.php?id=1"+ r + f+"&referer="+g+"' width='1' height='1' style='display:none'>");
*/

function my_set(){

var mydiv = document.getElementById("myset");
for (i=0; i <=  mydiv.getElementsByTagName("a").length - 1; i++){
mydiv.getElementsByTagName("a")[i].href = mydiv.getElementsByTagName("a")[i].href + '?viewmode=on';
	}
}

function ex_go (my_val) {
document.getElementById(my_val).style.display='block';
}

function ex_del (my_val){
document.getElementById(my_val).style.display='none';

}

/*	
	Chaosquake Land Mark System (c) by Dominic Szablewski 
	lms@chaosquake.de - chaosquake.de 
*/

//	Funktionen zum anzeigen/verstecken des Mouse-Over-DIVs


// Anzeigen u. Position / Inhalt setzen
function s(e, s) {
	var d = document.getElementById('inf');
	d.style.display="block";
	d.style.left= parseInt(e.style.left)+150;
	d.style.top= parseInt(e.style.top)+10;
	d.innerHTML=s;
}

// Verstecken
function h() {
	document.getElementById('inf').style.display="none";
}

/*	
	Chaosquake Land Mark System (c) by Dominic Szablewski 
	lms@chaosquake.de - chaosquake.de 
*/

//	AJAX-Funktionen zum laden alle Orte zu einer PLZ

var count=0;
var selId=0;

// Eintrag einer Dropdown hinzufügen
function selAppend(value, text) {
  var en = document.createElement('option');
  en.text = text;
  en.value = value;
  var e = document.getElementById('ort');

  try { e.add(en, null); } // non IE
  catch(ex) { e.add(en); } // IE
}

// Dropdownbox löschen
function selClear() {
	var e = document.getElementById('user_stadt');
	for (i = e.length - 1; i>=0; i--)
		e.remove(i);
}

// Einträge laden (AJAX)
function selLoad(e, id) {
	selClear();
	selId = id;
	if(e.value.length >= 4 && e.value.length <= 5) {	
		loadXML("lms3/inc/selort.xml.php?plz="+e.value);
	}
}

// XML-File laden
function loadXML(sFileName) {
	if (window.XMLHttpRequest) { // moz
		req = new XMLHttpRequest();
	} 
	else if (window.ActiveXObject) { // ie
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e) {}
		}
	}
	req.onreadystatechange = function(){ getmessage( ) };
	
	if(!req) return false;
	req.open('GET', sFileName, true);
	req.send(null);	
}

// XML-Parsen
function getmessage() {
	if (req.readyState == 4 && req.status == 200) {
	
		orte=req.responseXML.getElementsByTagName("ort");
		for(i=0;i<orte.length;i++) {
			ortId=parseInt(orte[i].getElementsByTagName("id")[0].firstChild.nodeValue, 10);
			ortName=orte[i].getElementsByTagName("name")[0].firstChild.nodeValue;
			selAppend(ortId, ortName);
		}
		reselect();		
	}
}

// Eintrag mit selId in der Dropdownbox selektieren
function reselect() {
	if(selId) {
		selBox = document.getElementById('ort');
		for(i=0; i < selBox.options.length; i++) {
			if(selBox.options[i].value == selId) {
				selBox.options[i].selected=true;
			}
		}
	}
}



