﻿// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well

function pageWidth() {    
    var returnVal = null;
    
    if(window.innerWidth != null){
        returnVal = window.innerWidth;
    }
    else if(document.documentElement && document.documentElement.clientWidth){
        returnVal = document.documentElement.clientWidth;
    }
    else if(document.body != null){
       returnVal = document.body.clientWidth;
    }
    return returnVal;
}

function pageHeight() { 
    var returnVal = null;
    
    if(window.innerHeight != null){
        returnVal = window.innerHeight;
    }
    else if(document.documentElement && document.documentElement.clientHeight){
       returnVal = document.documentElement.clientHeight;
    }
    else if(document.body != null){
        returnVal = document.body.clientHeight;
    }
    return returnVal;
}

function posLeft() {               
    var returnVal = 0;
    
    if(typeof window.pageXOffset != 'undefined'){
        returnVal = window.pageXOffset;
    }
    else if(document.documentElement && document.documentElement.scrollLeft){
        returnVal = document.documentElement.scrollLeft;
    }
    else if(document.body.scrollLeft){
        returnVal = document.body.scrollLeft;
    }
    
    return returnVal;
}


function posTop() {

    var returnVal = 0;
    
    if(typeof window.pageYOffset != 'undefined'){
        returnVal = window.pageYOffset;
    }
    else if(document.documentElement && document.documentElement.scrollTop){
        returnVal = document.documentElement.scrollTop;
    }
    else if(document.body.scrollTop){
       returnVal = document.body.scrollTop;
    }
    
    return returnVal;    
}


function posRight() {
    return posLeft()+pageWidth();
}

function posBottom() {
    return posTop()+pageHeight();
}
 
 
 function showMessage(){
    alert("hello!!!");
 }                 