﻿var xmlHttp

function addRate(ContentID,points)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="ajax.asp?ajaxaction=addrate";
url=url+"&ContentID="+ContentID;
url=url+"&Rating="+points;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=function(){
     if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
            document.getElementById("vote").innerHTML=xmlHttp.responseText;}
            };
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function addContestRate(ContentID, points) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Your browser does not support AJAX!");
        return;
    }
    var url = "ajax.asp?ajaxaction=addContestRate";
    url = url + "&ContentID=" + ContentID;
    url = url + "&Rating=" + points;
    url = url + "&sid=" + Math.random();
    xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
            document.getElementById("stars" + ContentID).style.display = 'none';
            document.getElementById("vote" + ContentID).innerHTML = xmlHttp.responseText;
    
        }
    };
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function RemovePhoto(ContentID, ContestID) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Your browser does not support AJAX!");
        return;
    }
    var url = "ajax.asp?ajaxaction=RemovePhoto";
    url = url + "&ContentID=" + ContentID;
    url = url + "&ContestID=" + ContestID;
    url = url + "&sid=" + Math.random();
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
                 document.getElementById("ContestPhoto").innerHTML = xmlHttp.responseText;

        }
    };
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function addComment(ContentTypeID,ParentContentID,CatID,Comments)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="ajax.asp?ajaxaction=addcomment";
url=url+"&LongDesc="+Comments;
url=url+"&ContentTypeID="+ContentTypeID;
url=url+"&ParentContentID="+ParentContentID;
url=url+"&CatID="+CatID;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=function(){
     if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
            document.getElementById("comments").style.display = 'none';
document.getElementById("quote_on").style.display = 'none';
document.getElementById("quote_off").style.display = 'block';
document.getElementById("comments_return").style.display = 'block';
document.getElementById("comments_return").innerHTML=xmlHttp.responseText;
        }
     };
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function subscribe(email,mailing_list)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="ajax.asp?ajaxaction=subscribe";
url=url+"&email="+email;
url=url+"&mailing_list="+mailing_list;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=function(){
     if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
            document.getElementById("subscribe_result").innerHTML=xmlHttp.responseText;}
            };
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showhide(ContentID,Display,divid) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Your browser does not support AJAX!");
        return;
    }
    var url = "ajax.asp?ajaxaction=showhide";
    url = url + "&ContentID=" + ContentID;
    url = url + "&Display=" + Display;
    url = url + "&divid=" + divid;
    url = url + "&sid=" + Math.random();
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
            document.getElementById("display" + divid).innerHTML = xmlHttp.responseText;
        }
    };
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}

function confirmphoto(ContentID,ContestID, Confirmed, divid) {
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Your browser does not support AJAX!");
        return;
    }
    var url = "ajax.asp?ajaxaction=confirmphoto";
    url = url + "&ContentID=" + ContentID;
    url = url + "&ContestID=" + ContestID;
    url = url + "&Confirmed=" + Confirmed;
    url = url + "&divid=" + divid;
    url = url + "&sid=" + Math.random();
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
            document.getElementById("Confirmed" + divid).innerHTML = xmlHttp.responseText;
        }
    };
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
}


function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("comments").style.display = 'none';
document.getElementById("quote_on").style.display = 'none';
document.getElementById("quote_off").style.display = 'block';
document.getElementById("comments_return").style.display = 'block';
document.getElementById("comments_return").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;
}