/* Function to clear text fields */
function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}

function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}

/* Popup function */
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400,left = 312,top = 184');");
}

/* Function to confirm logout */
function confirmLogout(url)
{
if (confirm('Are you sure you want to logout?'))
{
    xajax_gotoURL(url);
}
return void(0);
}

/* Function to delete gallery */
function deleteGallery(id, owner, gallery)
{
if (confirm('Are you sure you want to delete this gallery and all its images?'))
{
    xajax_deleteGallery(id, owner, gallery);
}
return void(0);
}

/* Function to create a gallery */
function createGallery()
{
    var d = document;
    var n = d.getElementById('galname').value;
    xajax_createGallery(n);
    return false;
}

/* Function to toggle the display */
var isIE = (navigator.appName == 'Microsoft Internet Explorer');
function toggleStg(e, id)
{
   var dv = document.getElementById('stg_' + id);
   dv.style.display = (dv.style.display == 'none') ? 'block' : 'none';

   if (isIE)
   {
   e = window.event;
   el = e.srcElement;
   }else{
   el = e.target;
   }
   dv.style.left = parseInt(e.clientX - 80) + 'px';
   dv.style.top  = parseInt(e.clientY + 15) + 'px';
}
	
/* Simple popup function */
function popUp(URL)
{
   day = new Date();
   id = day.getTime();
   eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=200,left = 312,top = 184');");
}

/* Function to delete an image from album */
function deleteimage(id, album_id, album_id, startrow)
{
if (confirm('Are you sure you want to delete this image?'))
{
    xajax_deleteImage(id, album_id, album_id, startrow);
}
return void(0);
}

/* Function to delete an image from my files */
function deleteimage2(id, startrow)
{
if (confirm('Are you sure you want to delete this image?'))
{
    xajax_deleteImage2(id, startrow);
}
return void(0);
}

/* Function to save users personal info */
function savePersonalInfo()
{
   var d = document;
   xajax_savePersonalInfo(d.getElementById('email').value);
   return false;
}

/* Function to save users password */
function savePassword()
{
  var d = document;
  var i1 = d.getElementById('new');
  var i2 = d.getElementById('cfm');
  var p1 = i1.value;
  var p2 = i2.value;
  xajax_savePassword(d.getElementById('old').value, p1, p2);
  return false;
}
