function deleteCartoon(id) {
  
  url = "actions.php?action=deletecartoon&id=" + id;
  var r=confirm("Haluatko varmasti poistaa sarjakuvan?");
  if (r==true)
  {
    window.location=url;
  }
  else
  {
  return;
  }
  

}
function deleteStory(id) {
  
  url = "actions.php?action=deletestory&id=" + id;
  var r=confirm("Haluatko varmasti poistaa tarinan?");
  if (r==true)
  {
    window.location=url;
  }
  else
  {
  return;
  }
  

}

function rejectStory(id) {
  
  var ContainerId = "#rejectstoryContainer"+id;
  $(ContainerId).slideDown();

}

function cancelStoryReject(id) {
  var ContainerId = "#rejectstoryContainer"+id;
  $(ContainerId).slideUp();
}


function rejectCartoon(id) {
  
  var ContainerId = "#rejectcartoonContainer"+id;
  $(ContainerId).slideDown();

}

function cancelCartoonReject(id) {
  var ContainerId = "#rejectcartoonContainer"+id;
  $(ContainerId).slideUp();
}


function check_pwd(){
if(document.registerform.password.value == document.registerform.password_check.value){
    return true;
}else{
    return false;
}
}

function getXmlHttp() {
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  return xmlHttp;
}


function sendCartoonNotification(id) {

xmlHttp = getXmlHttp();

if(xmlHttp == false) {
  return;
}

xmlHttp.onreadystatechange=function() {
    if(xmlHttp.readyState==4) {
      alert("Pyyntö vastaanotettu!");
    }
  }
  parameters = "action=addcartoonnotification&cartoonid="+id;
  xmlHttp.open("POST", "actions.php", true);
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", parameters.length);
  xmlHttp.send(parameters);


}

function sendStoryNotification(id) {

xmlHttp = getXmlHttp();

if(xmlHttp == false) {
  return;
}

xmlHttp.onreadystatechange=function() {
    if(xmlHttp.readyState==4) {
      alert("Pyyntö vastaanotettu!");
    }
  }
  parameters = "action=addstorynotification&storyid="+id;
  xmlHttp.open("POST", "actions.php", true);
  xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xmlHttp.setRequestHeader("Content-length", parameters.length);
  xmlHttp.send(parameters);


}
