 // JavaScript Document

var focus_hack = function(el) {
	var els,i;
	els = el.getElementsByTagName("INPUT");
	for(i=0;i<els.length;i++) 
		if(els[i].type == 'text' && els[i].value == '') {
			els[i].focus();
			break;
		}
};

function doadoda(twhat)
{
alert(twhat);
}

function changeimage(tlargewidth,tshortname,timage,tmaindir,tcnt)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="zidupdateimagediv.asp";
url=url+"?image="+encodeURIComponent(timage)+"&maindir="+tmaindir+"&shortname="+encodeURIComponent(tshortname)+"&largewidth="+tlargewidth+"&count="+tcnt;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=putimagediv;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
// if ((twhat=="newlogger") || (twhat=="newimportfile")) {
//	alert("Saved: " + tdata)
//}
return false;
}

function putimagediv()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("zidlargediv").innerHTML=xmlHttp.responseText;
	}
}

function callshoweditlist(timage,tmaindir,var3)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="zidshoweditlist.asp";
url=url+"?image="+encodeURIComponent(timage)+"&maindir="+tmaindir;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=puteditlistdiv;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

return false;
}


function calluploadimage(timage,tmode,tdescription,tcredit)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="ziduploadimage.asp";
url=url+"?image="+encodeURIComponent(timage)+"&mode="+tmode+"&description="+tdescription+"&credit="+tcredit;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=showuploaddiv;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
return false
}

function showuploaddiv()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("workdiv").innerHTML=xmlHttp.responseText;
	}
}

function calleditone(timage,tmode,tline1,tline2,trotate)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="zidshoweditone.asp";
url=url+"?image="+encodeURIComponent(timage)+"&mode="+tmode+"&line1="+tline1+"&line2="+tline2+"&rotate="+trotate;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=puteditlistdiv;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
return false
}

function puteditlistdiv()
{
	if (xmlHttp.readyState==4)
	{
		document.getElementById("workdiv").innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e)
    { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
  }
return xmlHttp;
}
