var _ME_HOSTNAME = getHostname();

$( function() {        
    

});

//       getHostname
function getHostname() {
    var str = document.location.href;
    var re = new RegExp('^(?:f|ht)tp(?:s)?\://([^/]+)', 'im');
    if( str.match(re)[1] != null ) return str.match(re)[1].toString();
    else return '';
}

//       get_rect_to_rect_scale
function get_rect_to_rect_scale( dim ){
    if ( typeof(dim.width) == "number" && dim.width>0 && typeof(dim.height) == "number" && dim.height>0 ){
      if ( typeof(dim.m_width) == "number" && dim.m_width>0 && typeof(dim.m_height) == "number" && dim.m_height>0 ){
        if ( dim.width<=dim.m_width && dim.height<=dim.m_height ){
          return dim;
        } else {
          if ( dim.width/dim.height > dim.m_width/dim.m_height ){
            var out_dim = new Array();
			out_dim.width = dim.m_width;
            out_dim.height = parseInt(dim.m_width*dim.height/dim.width);
            return out_dim;
          } else {
            var out_dim = new Array();
			out_dim.width = parseInt(dim.m_height*dim.width/dim.height);
            out_dim.height = dim.m_height;
            return out_dim;
          }
        }
      } else if ( typeof(dim.m_width) == "number" && dim.m_width>0 ){
        dim.m_height = dim.height;
        return get_rect_to_rect_scale( dim );
      } else if ( typeof(dim.m_height) == "number" && dim.m_height>0 ){
        dim.m_width = dim.width;
        return get_rect_to_rect_scale( dim );
      } else { return dim; }
    } else if ( typeof(dim.m_width) == "number" && dim.m_width>0 && typeof(dim.m_height) == "number" && dim.m_height>0 ){
		return {width: dim.m_width, height: dim.m_height};
	} else if ( typeof(dim.m_width) == "number" && dim.m_width>0 ){
		return {width: dim.m_width, height: dim.m_width};
	} else if ( typeof(dim.m_height) == "number" && dim.m_height>0 ) {
		return {width: dim.m_height, height: dim.m_height};
	} else {
            return {width: 0, height: 0};
    }
}
