﻿// JScript File
var xmlHttp

function delPic(str, picid, utype, tb, id)
{
    if (confirm("Are you sure you want to delete "+picid+"?"))
    { 
        //alert (str);
        first = str.indexOf("/", 0);
        //alert (first);
        str = str.substring(first, str.length);
        second = str.indexOf("/", first);
        //alert (second);
        str = str.substring(second, str.length);
        //third = str.indexOf("/", second);
        //str = str.substring((second - 2), str.length);
        //fourth = str.indexOf("/", 0);
        //str = str.substring(0, fourth);
        xmlHttp=GetXmlHttpObject();
        if (xmlHttp==null)
        {
        alert ("Browser does not support HTTP Request");
        return
        }
        
        if (picid == "mainpic")
        {
            picid = "MainPic";
        }
        //alert (tb);
        var url="deletepic.aspx";
        url=url+"?q="+str+"&s="+picid+"&t="+utype+"&i="+id+"&tb="+tb;
        //alert (url);
        switch(picid)
        {
            case "pic1":
            xmlHttp.onreadystatechange=stateChanged1;
            break;   
            case "pic2":
            xmlHttp.onreadystatechange=stateChanged2;
            break;
            case "pic3":
            xmlHttp.onreadystatechange=stateChanged3;
            break;
            case "pic4":
            xmlHttp.onreadystatechange=stateChanged4;
            break;
            case "pic5":
            xmlHttp.onreadystatechange=stateChanged5;
            break;
            case "pic6":
            xmlHttp.onreadystatechange=stateChanged6;
            break;
            case "pic7":
            xmlHttp.onreadystatechange=stateChanged7;
            break;
            case "pic8":
            xmlHttp.onreadystatechange=stateChanged8;
            break;
            case "MainPic":
            xmlHttp.onreadystatechange=stateChanged9;
            break;
        }
        //xmlHttp.onreadystatechange=stateChanged;
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }
    else
    {
        //window.close();
    }
}

function stateChanged1() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("pic1").src="images/additionalphoto.gif";
        document.getElementById("lpic1").href = "";
    } 
}
function stateChanged2() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("pic2").src="images/additionalphoto.gif";
        document.getElementById("lpic2").href = "";
    } 
} 
function stateChanged3() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("pic3").src="images/additionalphoto.gif";
        document.getElementById("lpic3").href = "";
    } 
} 
function stateChanged4() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("pic4").src="images/additionalphoto.gif";
        document.getElementById("lpic4").href="";
    } 
} 
function stateChanged5() 
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("pic5").src="images/additionalphoto.gif";
        document.getElementById("lpic5").href = "";
    } 
} 
function stateChanged6() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("pic6").src="images/additionalphoto.gif";
        document.getElementById("lpic6").href = "nothing";
    } 
} 
function stateChanged7() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("pic7").src="images/additionalphoto.gif";
        document.getElementById("lpic7").href = "";
    } 
} 
function stateChanged8() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("pic8").src="images/additionalphoto.gif";
        document.getElementById("lpic8").href = "";
    } 
} 
function stateChanged9() 
{ 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        document.getElementById("mainpic").src="images/yourphoto2.gif";
        document.getElementById("lmainpic").href = "";
    } 
} 

function GetXmlHttpObject()
{ 
    var objXMLHttp=null;
    if (window.XMLHttpRequest)
    {
        objXMLHttp=new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
return objXMLHttp;
}
function delSpon(url, id)
{
    if (confirm("Are you sure you want to delete this sponsor - "+id+"?\r\n\r\n\NOTE: Clicking OK to delete this sponsor will cause\r\nthe page to reload without saving your other changes\r\nif any were made."))
    { 
        window.location.replace(url);
    }
    else
    {
        //window.close();
    }
}
function delChair(url, id)
{
    if (confirm("Are you sure you want to delete this Chair Person - "+id+"?\r\n\r\n\NOTE: Clicking OK to delete this Chair Person will cause\r\nthe page to reload without saving your other changes\r\nif any were made."))
    { 
        window.location.replace(url);
    }
    else
    {
        //window.close();
    }
}
function delComm(url, id)
{
    if (confirm("Are you sure you want to delete this Committee Member - "+id+"?\r\n\r\n\NOTE: Clicking OK to delete this Committee Member will cause\r\nthe page to reload without saving your other changes\r\nif any were made."))
    { 
        window.location.replace(url);
    }
    else
    {
        //window.close();
    }
}
function delRFP(url, id)
{
    if (confirm("Are you sure you want to cancel RFP ID "+id+"?"))
    { 
        window.location.replace(url);
    }
    else
    {
        //window.close();
    }
}
function delEvent(url, name)
{
    if (confirm("Are you sure you want to delete your event "+name+"?"))
    { 
        window.location.replace(url);
    }
    else
    {
        //window.close();
    }
}


