// DarkEye JScript File
// Developed by KoreLogic - http://www.korelogic.co.uk
window.onload = function()
{
    loadGalleries()
    init();
}
function loadGalleries() {
  AjaxRequest.get(
    {
      'url':'galleries.aspx'
      ,'onLoading':function() { document.getElementById('galleries').innerHTML='<div class="loader"><p><img src=images/load.gif /><br/>Loading...</p></div>'; Effect.Appear('galleries') }
      ,'onSuccess':function(req){document.getElementById('galleries').innerHTML=req.responseText; Effect.BlindDown('comments');}
    }
  );
}

function submitForm(theform) {
  var status = AjaxRequest.submit(
    theform
    ,{
      'onSuccess':function(req){errorCheck(req.responseText);}
      ,'onLoading':function() { document.getElementById('errorTag').innerHTML='<p>Saving...</p></div>';}
    }
  );
  return status;
}

function setVote(rate) {
    document.getElementById('RatingInput').value = rate;
}

function errorCheck(state) {
    if(state == "OK"){
        Effect.BlindUp(document.getElementById('subGallery'));
        document.getElementById('errorTag').innerHTML='<p><strong>Submission Complete!</strong><br />Please login to DarkEye.</p>'
        Effect.Pulsate(document.getElementById('errorTag'));
    }else{
        document.getElementById('errorTag').innerHTML=state;
        Effect.Pulsate(document.getElementById('errorTag'));
    }
}