//-----------------------------------------------------------------------------
//
// MDS Common functions v1.0.0
//                                                                   2007-09-05
//
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// get browser inner width
//-----------------------------------------------------------------------------
function getBrowserWidth() {  
    if ( window.innerWidth ) {
        return window.innerWidth;
    } else if ( document.documentElement
        && document.documentElement.clientWidth != 0 ) {
        return document.documentElement.clientWidth;
    } else if ( document.body ) {
        return document.body.clientWidth;
    }
    return 0;  
}
//-----------------------------------------------------------------------------
// get browser inner height
//-----------------------------------------------------------------------------
function getBrowserHeight() {  
    if ( window.innerHeight ) {
        return window.innerHeight;
    } else if ( document.documentElement
        && document.documentElement.clientHeight != 0 ) {
        return document.documentElement.clientHeight;
    } else if ( document.body ) {
        return document.body.clientHeight;
    }
    return 0;  
}
//-----------------------------------------------------------------------------
// aliase : get element by id
//-----------------------------------------------------------------------------
function $(tagId) {
    return document.getElementById(tagId);
}
//-----------------------------------------------------------------------------
// Create HTTP Request
//-----------------------------------------------------------------------------
function createXMLHttpRequest(cbFunc) {
    var XMLhttpObject = null;
    try{
        XMLhttpObject = new XMLHttpRequest();
    }catch(e){
        try{
            XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e){
                return null;
            }
        }
    }
    if (XMLhttpObject) XMLhttpObject.onreadystatechange = cbFunc;
    return XMLhttpObject;
}
//-----------------------------------------------------------------------------
// Create Random String
//-----------------------------------------------------------------------------
function RandomString() {
	this.str = '';
	this.randam_char_array	= new Array(
		'a','b','c','d','e','f','g','h','i','j'
		,'k','l','m','n','o','p','q','r','s','t'
		,'u','v','w','x','y','z'
		,'A','B','C','D','E','F','G','H','I','J'
		,'K','L','M','N','O','P','Q','R','S','T'
		,'U','V','W','X','Y','Z'
		,'0','1','2','3','4','5','6','7','8','9'
	);
	this.get = function(strlen) {
		var str = '';
		for( i=0; i<8; i++ ){
			var rand = Math.floor( Math.random() * this.randam_char_array.length );
			str += this.randam_char_array[rand];
		}
		this.str=str;
		return str;
	}
	this.set = function(obj,strlen) {
		this.get(strlen);
		obj.value = this.str;
	}
}
