// end hide JavaScript
var windowNumber = 0;
var windowFrame = {width:0,height:0};
var sizeMainWindow = {width:0,height:0};
var mediaWindow = {top:0,left:0};
var currentParams = {};
/*
if (opener && opener.windowFrame) {
windowFrame = opener.windowFrame;
}
*/
function WindowOpenMain( width, height, windowName, param ) {
sizeMainWindow.width = width;
sizeMainWindow.height = height;
if (windowNumber == 0) {
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
}
else {
var tmp_left = (screen.width - width) / 2 + windowNumber * 20;
var tmp_top = (screen.height - height) / 2 + windowNumber * 20;
var left = Math.max(0, Math.min(tmp_left, screen.width - width));
var top = Math.max(0, Math.min(tmp_top, screen.height - height));
}
var keyword = param.keyword;
var pagecode = param.pagecode;
var sid = param.sid;
var paramStr = "";
if(keyword){
keyword = encodeURI(keyword);
paramStr = "?k=" + keyword;
}else{
paramStr = "?";
}
if(sid){
if(paramStr != "?"){
paramStr = paramStr + "&";
}
paramStr = paramStr + "sid=" + sid;
}
if(pagecode){
if(paramStr != "?"){
paramStr = paramStr + "&";
}
paramStr = paramStr + "pagecode=" + pagecode;
}else{
if(paramStr == "?"){
paramStr = "";
}
}
var hwnd = window.open("../_SWF_Window.html" + paramStr, windowName, "width=" + width + ",height=" + height + ","
+ "resizable=" + ((param.resizable)?param.resizable:'yes') + ","
+ "screenX=" + left + ","
+ "screenY=" + top + ","
+ "left=" + left + ","
+ "top=" + top + ","
+ "scrollbars=no"
);
windowNumber++;
if (is_ie) {
windowFrame.width = tmp_left - left;
windowFrame.height = tmp_top - top;
}
}
function WindowOpenSample( width, height, windowName, param ) {
sizeMainWindow.width = width;
sizeMainWindow.height = height;
if (windowNumber == 0) {
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
}
else {
var tmp_left = (screen.width - width) / 2 + windowNumber * 20;
var tmp_top = (screen.height - height) / 2 + windowNumber * 20;
var left = Math.max(0, Math.min(tmp_left, screen.width - width));
var top = Math.max(0, Math.min(tmp_top, screen.height - height));
}
var hwnd = window.open("_SWF_Window.html?mode=1063", windowName, "width=" + width + ",height=" + height + ","
+ "resizable=" + ((param.resizable)?param.resizable:'yes') + ","
+ "screenX=" + left + ","
+ "screenY=" + top + ","
+ "left=" + left + ","
+ "top=" + top + ","
+ "scrollbars=no"
);
windowNumber++;
if (is_ie) {
windowFrame.width = tmp_left - left;
windowFrame.height = tmp_top - top;
}
}
function WindowOpenMedia( url, params ) {
var width_match = new String(params.match( /width=([0-9]+)/i ));
var height_match = new String(params.match( /height=([0-9]+)/i ));
var width = width_match.substring(width_match.indexOf(",")+1);
var height = height_match.substring(height_match.indexOf(",")+1);
var left = (screen.width - width) / 2;
var top = (screen.height - height) / 2;
params = params + ((params == '')?'':',')
+ "resizable=yes,"
+ "screenX=" + left + ","
+ "screenY=" + top + ","
+ "left=" + left + ","
+ "top=" + top + "";
var hwnd = window.open( url, "MediaWindow", params );
}
function getLeftMargin() {
if (is_ie) {
return windowFrame.width + 2;
}
if (is_gecko) {
return 3;
}
if (is_opera) {
return window.screenX;
}
return 0;
}
function getTopMargin() {
if (is_ie) {
return windowFrame.height + 2;
}
if (is_gecko) {
return 23;
}
if (is_opera) {
return window.screenY;
}
return 0;
}
function getWindowLeft() {
if (is_ie) {
return window.screenLeft;
}
if (is_gecko) {
return window.screenX;
}
if (is_opera) {
return window.screenX;
}
return (window.screenLeft | window.screenX);
}
function getWindowTop() {
if (is_ie) {
return window.screenTop;
}
if (is_gecko) {
return window.screenY;
}
if (is_opera) {
return window.screenY;
}
return (window.screenTop | window.screenY);
}
function getInnerWidth() {
if (is_ie) {
return document.body.clientWidth;
}
if (is_gecko) {
return window.innerWidth;
}
if (is_opera) {
return window.innerWidth;
}
return (window.innerWidth | document.body.clientWidth);
}
function getInnerHeight() {
if (is_ie) {
return document.body.clientHeight;
}
if (is_gecko) {
return window.innerHeight;
}
if (is_opera) {
return window.innerHeight;
}
return (window.innerHeight | document.body.clientHeight);
}
function getTopToolbarMargin() {
if (is_ie) {
return 0;//windowFrame.height + 2;
}
if (is_gecko) {
return 67;
}
if (is_opera) {
return 0;//window.screenY;
}
return 0;
}
function _parseParamString( str ) {
var params = new Array;
var tmp = str.match( /[^=,&]+=[^=,&]+/ig );
for ( var i = 0 ; i < tmp.length ; i++ ) {
var tmp2 = tmp[i].match( /([^=,&]+)=([^=,&]+)/i );
params[tmp2[1]] = tmp2[2];
}
return params;
}
function _joinParamString( paramArray ) {
var retString = "";
for ( key in paramArray ) {
retString += key + "=" + paramArray[key] + ",";
}
if (retString.length !== 0) {
retString = retString.substring(0, retString.length - 1);
}
return retString;
}
function getMediaType( url ) {
var ext = url.match( /(?:\.([^\/\.]+))?$/i );
var type = "page";
if (ext[1]) {
switch (ext[1].toLowerCase()) {
case "avi":
case "asf":
case "asx":
case "wmv":
type = "wmv";
break;
case "mp3":
type = "mp3";
break;
case "swf":
type = "swf";
break;
case "flv":
type = "flv";
break;
case "mov":
case "mpeg":
case "mpg":
case "mp4":
type = "quicktime";
break;
case "jpg":
case "jpeg":
case "png":
case "gif":
type = "image";
break;
}
}
return type;
}
var typesProperty = {
"page":{
"toolbar":"yes"
}, "wmv":{
"toolbar":"no"
},
"mp3":{
"toolbar":"no"
},
"swf":{
"toolbar":"no"
},
"quicktime":{
"toolbar":"no"
},
"image":{
"toolbar":"no"
},
"flv":{
"toolbar":"no"
}
};
/**
* メディア用Windowオープン関数
*
* @param string url URL
* @param string paramString パラメータをkey1=value1,key2=value2,...の形式で指定する
*/
function WindowOpenRelative( url, paramString ) {
var params = _parseParamString(paramString);
this.currentParams = _parseParamString(paramString);
var type = getMediaType(url);
if (!params.toolbar) {
params.toolbar = typesProperty[type].toolbar;
}
// 20120830
if (opener.sizeMainWindow) {
var autoScaleX = (opener && opener.sizeMainWindow.width != 0)?getInnerWidth() / opener.sizeMainWindow.width:1.0;
var autoScaleY = (opener && opener.sizeMainWindow.height != 0)?getInnerHeight() / opener.sizeMainWindow.height:1.0;
} else {
var autoScaleX = getInnerWidth() / 1000;
var autoScaleY = getInnerHeight() / 670;
}
// 20120830
var scaleX = (params.scaleX)?Number(params.scaleX) / 100.0:autoScaleX;
var scaleY = (params.scaleY)?Number(params.scaleY) / 100.0:autoScaleY;
var width = Number(params.width) * scaleX;
var height = Number(params.height) * scaleY;
var relleft = Number(params.relleft) * scaleX;
var reltop = Number(params.reltop) * scaleY;
var left = getWindowLeft() + relleft/* + getLeftMargin()*/;
var top = getWindowTop() + reltop - ((params.toolbar == "yes")?getTopToolbarMargin():0);
// FullScreen
if ((is_gecko || is_ie) && params.fullscreen == "yes") {
left = 0;
top = 0;
width = screen.width - (windowFrame.width * 2);
height = screen.height - (windowFrame.height);
params.fullscreen = "no";
}
params.resizable = "yes";
params.screenX = left;
params.screenY = top;
params.left = left;
params.top = top;
params.width = width;
params.height = height;
params.allowscriptaccess = "always";
mediaWindow.width = width;
mediaWindow.height = height;
mediaWindow.top = top;
mediaWindow.left = left;
mediaWindow.type = type;
if(type == "flv"){
mediaWindow.type = "swf";
mediaWindow.url = "FlvPlayer.swf";
mediaWindow.swfpath = url;
}else{
mediaWindow.url = url;
}
var paramString = _joinParamString(params);
mediaWindow.params = paramString;
//var hwnd = window.open( "MediaTemplate.html", "_blank", paramString );
document.getElementById("open").click();
}
function toBookLink(url){
window.location = url;
}
function openMediaWindow(paramString){
window.open('MediaTemplate.html', "_blank", paramString);
}
// 20120809
function actimgrOpenMediaWindow(url,paramString){
window.open(url+'MediaTemplate.html', "_blank", paramString);
}
function onLoadMediaWindow() {
if (is_ie) {
if (opener.currentParams.fullscreen != "yes") {
var moveRelX = -(getWindowLeft() - opener.mediaWindow.left);
var moveRelY = -(getWindowTop() - opener.mediaWindow.top);
//window.moveBy(moveRelX, moveRelY);
}
}
}
function putMediaTag() {
document.write("");
}