//ï»?
/// For Displaying Hotel/Course Details in a popup
function HotelDetails(hotelId)
{
    var r = PageMethods.GetHotelDetails(hotelId, OnSuccess, OnException, OnTimeOut);
    //return false;
}

function CourseDetails(courseId)
{
    var r = PageMethods.GetCourseDetails(courseId, OnSuccess, OnException, OnTimeOut);
    //return false;
}

function OnSuccess(args)
{
    if(args !="")
    {
        var popupid = document.getElementById('popup');
        popupid.innerHTML = args;
        ShowPopup(popupid.id,true);
    }
    //return false;
}

function OnException(args)
{
    alert('An Exception has occured. Please try again.');
    //return false;
}

function OnTimeOut(args)
{
    alert('Your request is timed out. Please Try again.');
    //return false;
}
var scrollY = 0;
function ShowPopup(panel,bool)
{
    panel = document.getElementById(panel);
    
    var my_width  = 0;
    var my_height = 0;

    if ( typeof( window.innerWidth ) == 'number' ){
        my_width  = window.innerWidth;
        my_height = window.innerHeight;
    }else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ){
        my_width  = document.documentElement.clientWidth;
        my_height = document.documentElement.clientHeight;
    }
    else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ){ 
        my_width  = document.body.clientWidth;
        my_height = document.body.clientHeight;
    }
    

    

    if ( document.documentElement && document.documentElement.scrollTop ){
        scrollY = document.documentElement.scrollTop;
    }else if ( document.body && document.body.scrollTop ){
        scrollY = document.body.scrollTop;
    }else if ( window.pageYOffset ){
        scrollY = window.pageYOffset;
    }else if ( window.scrollY ){
        scrollY = window.scrollY;
    }

    var elementDimensions = new ElementDimensions(panel);
    var setX = (my_width - elementDimensions.inner.width) / 2;
    var setY = (my_height - elementDimensions.inner.height) / 2 + scrollY;

    setX = ( setX < 0 ) ? 0 : setX;
    setY = ( setY < 0 ) ? 0 : setY;

    panel.style.top = setY + "px";
    panel.style.left = setX + "px";
    panel.style.position = "absolute";
    panel.style.zIndex = "99";
    disablePage(bool);
    panel.style.visibility = bool ? "visible" : "hidden";
}

function ElementDimensions(elem)
{	
    this.inner = {	//content and padding; gives 0 for inline elements (you can use scrollWidth/Height if it's inline)
        width: elem.clientWidth,		
        height: elem.clientHeight	};	
    this.outer = {	//everything (content, padding, scrollbar, border)		
        width: elem.offsetWidth,		
        height: elem.offsetHeight	};	
    this.scroll = {		//width & height of entire content field (including padding), visible or not		//incorrect in Opera; it doesn't include the padding		
        width: elem.scrollWidth,		//if there are no scrollbars, IE gives the actual height of the content instead of the height of the element		
        height: elem.scrollHeight<elem.clientHeight ? elem.clientHeight : elem.scrollHeight, 		//scroll position of content & padding		
        left: elem.scrollLeft,
        top: elem.scrollTop
    }; 	//position of element from the top-left corner of the document
    
    var tmp = elem; 
    this.left = this.top = 0;
    while (tmp.offsetParent) {
        this.left += tmp.offsetLeft;
        this.top += tmp.offsetTop;
        tmp = tmp.offsetParent;
    }
}


function disablePage(bool)
{
    if(bool)
    {
        var blurDiv = document.createElement("div"); 
        blurDiv.id = "blurDiv";
        blurDiv.style.cssText = "position:absolute; top:0; right:0; width:" + (screen.width + scrollY) + "px; height:" + (screen.height + 600) + "px; background-color:#000000; opacity:0.2; filter:alpha(opacity=20)"; 
        document.getElementsByTagName("body")[0].appendChild(blurDiv); 
    }
    else{
        var div = document.getElementById('blurDiv');
        if(div != undefined) document.body.removeChild(div);
    }
}


