/*
    File: artgallery.js
    Purpose: Javascript functions in support of Art Gallery Wordpress theme.
	Theme Name: Art Gallery
	Theme URI: www.forsako.com/ArtGalleryTheme/
	Description: A Wordpress theme which is primarily intended for clean display of images.
	Author: Gabriel Putnam
	Author URI: www.forsako.com
	Template:
	Version: 1.0
	Date: December 2009
*/

function ajaxFunction( target_in, url_in ) {
    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;
            }
        }
    }

    // Send array to php
    xmlHttp.open( "GET", url_in, true );

    //Send the proper header information along with the request
    //xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    //xmlHttp.setRequestHeader("Content-length", url_args.length);
    //xmlHttp.setRequestHeader("Connection", "close");

    xmlHttp.onreadystatechange = function(){
        if( xmlHttp.readyState == 4 ) {
            target_in.innerHTML = xmlHttp.responseText;
        }
    }

    xmlHttp.send( null );
}

function ChangeContent( Content_URL ){
    var ContentObject = document.getElementById("content");
	ajaxFunction( ContentObject, TemplateURL + "/" + Content_URL );
}
