﻿
function setupDisable(checkobj)
{
    var x = 0;
    
    
  
    if (checkobj.checked == true)
    {
        document.getElementById(btn_deleteListing1).disabled = true 
        document.getElementById(btn_deleteListing2).disabled = true
        document.getElementById(btn_disableListing1).disabled = false
        document.getElementById(btn_disableListing2).disabled = false
        
        with (document.forms[0].all)
        {
            for (var i=0; i < document.forms[0].elements.length; i++) 
            {
                if (document.forms[0].elements[i].type == 'checkbox' && document.forms[0].elements[i].name == 'CheckDelete')
                {
                    document.forms[0].elements[i].checked = false;
                }
            }
        }
    }
    else
    {
        with (document.forms[0].all)
        {
            for (var i=0; i < document.forms[0].elements.length; i++) 
            {
                if (document.forms[0].elements[i].type == 'checkbox' && document.forms[0].elements[i].name == 'CheckDisable')
                {
                    if (document.forms[0].elements[i].checked == true) 
                    {
                        x++;
                    }
                }
            }
            if (x == 0)
            {
                document.getElementById(btn_disableListing1).disabled = true
                document.getElementById(btn_disableListing2).disabled = true
            }
        }
    }
}

function setupDelete(checkobj)
{
    var x = 0;
  
    if (checkobj.checked == true)
    {
        document.getElementById(btn_deleteListing1).disabled = false 
        document.getElementById(btn_deleteListing2).disabled = false
        document.getElementById(btn_disableListing1).disabled = true 
        document.getElementById(btn_disableListing2).disabled = true
        
        with (document.forms[0].all)
        {
            for (var i=0; i < document.forms[0].elements.length; i++) 
            {
                if (document.forms[0].elements[i].type == 'checkbox' && document.forms[0].elements[i].name == 'CheckDisable')
                {
                    document.forms[0].elements[i].checked = false;
                }
            }
        }
    }
    else
    {
        with (document.forms[0].all)
        {
            for (var i=0; i < document.forms[0].elements.length; i++) 
            {
                if (document.forms[0].elements[i].type == 'checkbox' && document.forms[0].elements[i].name == 'CheckDelete')
                {
                    if (document.forms[0].elements[i].checked == true) 
                    {
                        x++;
                    }
                }
            }
            if (x == 0)
            {
                document.getElementById(btn_deleteListing1).disabled = true
                document.getElementById(btn_deleteListing2).disabled = true
            }
        }
    }
}

function openWindow(strURL)
{
	if (strURL.indexOf('http') ==-1)
	{
		strURL = "http://" + strURL;
	}
	window.open(strURL);
}

function openPhoto(thePhoto,winTitle) {
	//This function opens a new browser on the client in which to present
	//the associated attraction photograph

	var photoWin
	var n = navigator.appName;
	if (n == "Microsoft Internet Explorer") {if (photoWin) {photoWin.close();}}    
   	if (n == "Netscape") {if (photoWin) { if (photoWin.document) {photoWin.close();}}}

	var crlf = String.fromCharCode(13) + String.fromCharCode(13);

    photoWin = window.open("","photoWin","scrollbars=no,menubar=no,resizable=yes,height=100,width=100",true);

	if (winTitle.length == 0)
	{
		winTitle = "Attraction Graphic"
	}
	
    photoWin.document.write("<HTML>" + crlf);
	photoWin.document.write("<HEAD>" + crlf);
	photoWin.document.write("<TITLE>" + winTitle + "</TITLE>" + crlf);
    photoWin.document.write("</HEAD>" + crlf);
    photoWin.document.write("<BODY>" + crlf);
    
    if (n == "Microsoft Internet Explorer") {
		photoWin.document.write("<IMG name='photo' SRC='" + thePhoto + "' ALT='" + winTitle + "' TITLE='" + winTitle +"' vspace=0 hspace=0 border=0 onload='window.resizeTo(this.width+30,this.height+60)'>" + crlf);
	}else{
		photoWin.document.write("<IMG name='photo' SRC='" + thePhoto + "' ALT='" + winTitle + "' TITLE='" + winTitle +"' vspace=0 hspace=0 border=0 onload='window.resizeTo(this.width+20,this.height+20)'>" + crlf);
	}
    photoWin.document.write("</BODY>" + crlf);
    photoWin.document.write("</HTML>" + crlf);
    photoWin.document.close();
    photoWin.focus();
}