/***********************************************
* Dynamic Ajax Content- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function ajaxpage(url, containerid,contentid,callBack){


    var self = $("#" + containerid);
    var selector = "#" + contentid;

    // Request the remote document
    jQuery.ajax({
        url: url,
        type: "GET",
        dataType: "html",

        complete: function(res, status) {
            // If successful, inject the HTML into all the matched elements
            if (status === "success" || status === "notmodified") {
                // See if a selector was specified
                self.html(
						jQuery("<div />")
                // inject the contents of the document in, removing the scripts
                // to avoid any 'Permission Denied' errors in IE
							.append(res.responseText)

                // Locate the specified elements
							.find(selector));
            }

            
           if (callBack) eval(callBack);
            
        }
    });

}


function ajaxpageText(url, containerid, contentid, callBack, isSkipScroll) {

    $("#" + containerid).load(url + " #" + contentid, "", function() {

    if (callBack) eval(callBack);
    if (isSkipScroll != 1) {
        $('html, body').animate({ scrollTop: 0 }, 'slow');
    }

    });

}



function highLightCurrentPageTab(){
	var pathname = (window.location.pathname.match(/[^\/]+$/)[0]);

    $('#head ul li a').each(function() {
    if ($(this).attr('href') == pathname)
    {
		var activeClass = $(this).attr('activeClass');
        if(activeClass) $(this).addClass(activeClass);
    }
    });
}


// load pre selected page on the left navigation panel
function loadPreSelectedPage() {
    var preSelectPageName = $.hash("pageR");
    if (preSelectPageName) {
        $("#" + preSelectPageName).click();
    } else {
        $("#left>ul>li:first").click()
    }
}

function loadPreSelectedWiePage() {
    var preSelectPageName = $.hash("pageR");
    if (preSelectPageName) {
        $("#" + preSelectPageName).click();
    } else {
        $("#leftWie>ul>li:first").click()
    }
}


function PrintContent(divIdtoprint) {
    var DocumentContainer = document.getElementById(divIdtoprint);
    var WindowObject = window.open("", "PrintWindow",
"width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes");
    WindowObject.document.writeln(DocumentContainer.innerHTML);
    WindowObject.document.close();
    WindowObject.focus();
    WindowObject.print();
    WindowObject.close();
}


function getFlashMovieObject(movieName) {
    if (window.document[movieName]) {
        return window.document[movieName];
    }
    if (navigator.appName.indexOf("Microsoft Internet") == -1) {
        if (document.embeds && document.embeds[movieName])
            return document.embeds[movieName];
    }
    else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    {
        return document.getElementById(movieName);
    }
}

