var connector = '/_administrator/connector.php';
var cookie_first_url = 'cms_first_url';
var site_path = '';
var fileLoadingImage2 = "/_administrator/images/loading.gif";
var fileBottomNavCloseImage2 = "/_administrator/images/closelabel.gif";
var overlayOpacity2 = 0.8;// controls transparency of shadow overlay
var animate2 = true;// toggles resizing animations
var resizeSpeed2 = 7;// controls the speed of the image resizing animations (1=slowest and 10=fastest)
var borderSize2 = 10;//if you adjust the padding in the CSS, you will need to update this variable
var imageArray2 = new Array;
var activeImage2;
if(animate2 == true){
overlayDuration2 = 0.2;// shadow fade in/out duration
if(resizeSpeed2 > 10){ resizeSpeed2 = 10;}
if(resizeSpeed2 < 1){ resizeSpeed2 = 1;}
resizeDuration2 = (11 - resizeSpeed2) * 0.15;
} else {
overlayDuration2 = 0;
resizeDuration2 = 0;
}
Object.extend(Element, {
getWidth: function(element) {
element = $(element);
return element.offsetWidth;
},
setWidth: function(element,w) {
element = $(element);
element.style.width = w +"px";
},
setHeight: function(element,h) {
element = $(element);
element.style.height = h +"px";
},
setTop: function(element,t) {
element = $(element);
element.style.top = t +"px";
},
setLeft: function(element,l) {
element = $(element);
element.style.left = l +"px";
},
setSrc: function(element,src) {
element = $(element);
element.src = src;
},
setHref: function(element,href) {
element = $(element);
element.href = href;
},
setInnerHTML: function(element,content) {
element = $(element);
element.innerHTML = content;
}
});
// -----------------------------------------------------------------------------------
//
//Extending built-in Array object
//- array.removeDuplicates()
//- array.empty()
//
Array.prototype.removeDuplicates = function () {
for(i = 0; i < this.length; i++){
for(j = this.length-1; j>i; j--){
if(this[i][0] == this[j][0]){
this.splice(j,1);
}
}
}
}
// -----------------------------------------------------------------------------------
Array.prototype.empty = function () {
for(i = 0; i <= this.length; i++){
this.shift();
}
}
// -----------------------------------------------------------------------------------
//
//Lightbox Class Declaration
//- initialize()
//- start()
//- changeImage()
//- resizeImageContainer()
//- showImage()
//- updateDetails()
//- updateNav()
//- enableKeyboardNav()
//- disableKeyboardNav()
//- keyboardNavAction()
//- preloadNeighborImages()
//- end()
//
//Structuring of code inspired by Scott Upton (http://www.uptonic.com/)
//
var Lightbox2 = Class.create();
Lightbox2.prototype = {
// initialize()
// Constructor runs on completion of the DOM loading. Calls updateImageList and then
// the function inserts html at the bottom of the page which is used to display the shadow
// overlay and the image container.
//
initialize: function() {
this.updateImageList();
// Code inserts html at the bottom of the page that looks similar to this:
//
//
//
//
//
//
![]()
//
//
//
//
//
//
var objBody = document.getElementsByTagName("body").item(0);
var objOverlay = document.createElement("div");
objOverlay.setAttribute('id','overlay2');
objOverlay.style.display = 'none';
objOverlay.onclick = function() { myLightbox2.end(); }
objBody.appendChild(objOverlay);
var objLightbox2 = document.createElement("div");
objLightbox2.setAttribute('id','lightbox2');
objLightbox2.style.display = 'none';
objLightbox2.onclick = function(e) {// close Lightbox is user clicks shadow overlay
if (!e) var e = window.event;
var clickObj = Event.element(e).id;
if ( clickObj == 'lightbox2') {
myLightbox2.end();
}
};
objBody.appendChild(objLightbox2);
var objOuterImageContainer = document.createElement("div");
objOuterImageContainer.setAttribute('id','outerImageContainer2');
objLightbox2.appendChild(objOuterImageContainer);
// When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
// If animations are turned off, it will be hidden as to prevent a flicker of a
// white 250 by 250 box.
if(animate2){
Element.setWidth('outerImageContainer2', 250);
Element.setHeight('outerImageContainer2', 250);
} else {
Element.setWidth('outerImageContainer2', 1);
Element.setHeight('outerImageContainer2', 1);
}
var objImageContainer = document.createElement("div");
objImageContainer.setAttribute('id','imageContainer2');
objOuterImageContainer.appendChild(objImageContainer);
var objLightboxImage = document.createElement("img");
objLightboxImage.setAttribute('id','lightboxImage2');
objImageContainer.appendChild(objLightboxImage);
var objHoverNav = document.createElement("div");
objHoverNav.setAttribute('id','hoverNav2');
objImageContainer.appendChild(objHoverNav);
var objPrevLink = document.createElement("a");
objPrevLink.setAttribute('id','prevLink2');
objPrevLink.setAttribute('href','#');
objHoverNav.appendChild(objPrevLink);
var objNextLink = document.createElement("a");
objNextLink.setAttribute('id','nextLink2');
objNextLink.setAttribute('href','#');
objHoverNav.appendChild(objNextLink);
var objLoading = document.createElement("div");
objLoading.setAttribute('id','loading2');
objImageContainer.appendChild(objLoading);
var objLoadingLink = document.createElement("a");
objLoadingLink.setAttribute('id','loadingLink2');
objLoadingLink.setAttribute('href','#');
objLoadingLink.onclick = function() { myLightbox2.end(); return false; }
objLoading.appendChild(objLoadingLink);
var objLoadingImage = document.createElement("img");
objLoadingImage.setAttribute('src', fileLoadingImage2);
objLoadingLink.appendChild(objLoadingImage);
var objImageDataContainer = document.createElement("div");
objImageDataContainer.setAttribute('id','imageDataContainer2');
objLightbox2.appendChild(objImageDataContainer);
var objImageData = document.createElement("div");
objImageData.setAttribute('id','imageData2');
objImageDataContainer.appendChild(objImageData);
var objImageDetails = document.createElement("div");
objImageDetails.setAttribute('id','imageDetails2');
objImageData.appendChild(objImageDetails);
var objCaption = document.createElement("span");
objCaption.setAttribute('id','caption2');
objImageDetails.appendChild(objCaption);
var objNumberDisplay = document.createElement("span");
objNumberDisplay.setAttribute('id','numberDisplay2');
objImageDetails.appendChild(objNumberDisplay);
var objBottomNav = document.createElement("div");
objBottomNav.setAttribute('id','bottomNav2');
objImageData.appendChild(objBottomNav);
var objBottomNavCloseLink = document.createElement("a");
objBottomNavCloseLink.setAttribute('id','bottomNavClose2');
objBottomNavCloseLink.setAttribute('href','#');
objBottomNavCloseLink.onclick = function() { myLightbox2.end(); return false; }
objBottomNav.appendChild(objBottomNavCloseLink);
var objBottomNavCloseImage = document.createElement("img");
objBottomNavCloseImage.setAttribute('src', fileBottomNavCloseImage2);
objBottomNavCloseLink.appendChild(objBottomNavCloseImage);
},
//
// updateImageList()
// Loops through anchor tags looking for 'lightbox' references and applies onclick
// events to appropriate links. You can rerun after dynamically adding images w/ajax.
//
updateImageList: function() {
if (!document.getElementsByTagName){ return; }
var anchors = document.getElementsByTagName('a');
var areas = document.getElementsByTagName('area');
// loop through all anchor tags
for (var i=0; i 1){
Element.show('numberDisplay2');
Element.setInnerHTML( 'numberDisplay2', "Image " + eval(activeImage2 + 1) + " of " + imageArray2.length);
}
new Effect.Parallel(
[ new Effect.SlideDown( 'imageDataContainer2', { sync: true, duration: resizeDuration2, from: 0.0, to: 1.0 }),
new Effect.Appear('imageDataContainer2', { sync: true, duration: resizeDuration2 }) ],
{ duration: resizeDuration2, afterFinish: function() {
// update overlay size and update nav
var arrayPageSize = getPageSize();
Element.setHeight('overlay2', arrayPageSize[1]);
myLightbox2.updateNav();
}
}
);
},
//
//updateNav()
//Display appropriate previous and next hover navigation.
//
updateNav: function() {
Element.show('hoverNav2');
// if not first image in set, display prev image button
if(activeImage2 != 0){
Element.show('prevLink2');
document.getElementById('prevLink2').onclick = function() {
myLightbox2.changeImage(activeImage2 - 1); return false;
}
}
// if not last image in set, display next image button
if(activeImage2 != (imageArray2.length - 1)){
Element.show('nextLink2');
document.getElementById('nextLink2').onclick = function() {
myLightbox2.changeImage(activeImage2 + 1); return false;
}
}
this.enableKeyboardNav();
},
//
//enableKeyboardNav()
//
enableKeyboardNav: function() {
document.onkeydown = this.keyboardAction;
},
//
//disableKeyboardNav()
//
disableKeyboardNav: function() {
document.onkeydown = '';
},
//
//keyboardAction()
//
keyboardAction: function(e) {
if (e == null) { // ie
keycode = event.keyCode;
escapeKey = 27;
} else { // mozilla
keycode = e.keyCode;
escapeKey = e.DOM_VK_ESCAPE;
}
key = String.fromCharCode(keycode).toLowerCase();
if((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)){// close lightbox
myLightbox2.end();
} else if((key == 'p') || (keycode == 37)){// display previous image
if(activeImage2 != 0){
myLightbox2.disableKeyboardNav();
myLightbox2.changeImage(activeImage2 - 1);
}
} else if((key == 'n') || (keycode == 39)){// display next image
if(activeImage2 != (imageArray2.length - 1)){
myLightbox2.disableKeyboardNav();
myLightbox2.changeImage(activeImage2 + 1);
}
}
},
//
//preloadNeighborImages()
//Preload previous and next images.
//
preloadNeighborImages: function(){
if((imageArray2.length - 1) > activeImage2){
preloadNextImage = new Image();
preloadNextImage.src = imageArray2[activeImage2 + 1][0];
}
if(activeImage2 > 0){
preloadPrevImage = new Image();
preloadPrevImage.src = imageArray2[activeImage2 - 1][0];
}
},
//
//end()
//
end: function() {
this.disableKeyboardNav();
Element.hide('lightbox2');
new Effect.Fade('overlay2', { duration: overlayDuration2});
showSelectBoxes();
showFlash();
}
}
// -----------------------------------------------------------------------------------
//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.com
//
function getPageScroll(){
var xScroll, yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
xScroll = document.body.scrollLeft;
}
arrayPageScroll = new Array(xScroll,yScroll)
return arrayPageScroll;
}
// -----------------------------------------------------------------------------------
//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.com
// Edit for Firefox by pHaez
//
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
//console.log(self.innerWidth);
//console.log(document.documentElement.clientWidth);
if (self.innerHeight) {// all except Explorer
if(document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
} else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
//console.log("xScroll " + xScroll)
//console.log("windowWidth " + windowWidth)
// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = xScroll;
} else {
pageWidth = windowWidth;
}
//console.log("pageWidth " + pageWidth)
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}
// -----------------------------------------------------------------------------------
//
// getKey(key)
// Gets keycode. If 'x' is pressed then it hides the lightbox.
//
function getKey(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
key = String.fromCharCode(keycode).toLowerCase();
if(key == 'x'){
}
}
// -----------------------------------------------------------------------------------
//
// listenKey()
//
function listenKey () {document.onkeypress = getKey; }
// ---------------------------------------------------
function showSelectBoxes(){
var selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "visible";
}
}
// ---------------------------------------------------
function hideSelectBoxes(){
var selects = document.getElementsByTagName("select");
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = "hidden";
}
}
// ---------------------------------------------------
function showFlash(){
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++) {
flashObjects[i].style.visibility = "visible";
}
var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++) {
flashEmbeds[i].style.visibility = "visible";
}
}
// ---------------------------------------------------
function hideFlash(){
var flashObjects = document.getElementsByTagName("object");
for (i = 0; i < flashObjects.length; i++) {
flashObjects[i].style.visibility = "hidden";
}
var flashEmbeds = document.getElementsByTagName("embed");
for (i = 0; i < flashEmbeds.length; i++) {
flashEmbeds[i].style.visibility = "hidden";
}
}
// ---------------------------------------------------
//
// pause(numberMillis)
// Pauses code execution for specified time. Uses busy code, not good.
// Help from Ran Bar-On [ran2103@gmail.com]
//
function pause(ms){
var date = new Date();
curDate = null;
do{var curDate = new Date();}
while( curDate - date < ms);
}
// ---------------------------------------------------
function initLightbox2() { myLightbox2 = new Lightbox2(); }
Event.observe(window, 'load', initLightbox2, false);// Smart Phone用モバイルサイトへのリンク
var strUA = navigator.userAgent.toLowerCase();
Event.observe(window,'load',function(){
if( !!document.getElementById('published') )
{
if( strUA.match(/iphone/) || strUA.match(/ipod/) || strUA.match(/android/) )
{
var div = document.createElement('div');
div.id = 'cmsMobileButton';
div.style.textAlign = 'center';
div.style.height = '50px';
var a = document.createElement('a');
a.href = 'http://sgmto.co.jp/index.php?a=free_page/goto_mobile&referer='+encodeURI(location.href);
a.innerHTML = '表示:モバイル';
div.appendChild(a);
document.body.appendChild(div);
a.style.margin = '30px auto';
a.style.padding = '5px 10px';
a.style.border = '1px solid #233656';
a.style.width = 'auto';
a.style.color = '#ffffff';
a.style.backgroundColor = '#394d68';
a.style.backgroundImage = '-webkit-gradient(linear, left top, left bottom, from(#5e789f), to(#42566f))';
a.style.fontSize = '12px';
a.style.borderRadius = '4px';
a.style.WebkitBorderRadius = '4px';
a.style.textShadow = '#000000 0 -1px 1px';
a.style.textDecoration = 'none';
}
}
});
var mobile = false;
if( strUA.match(/iphone/) || strUA.match(/ipod/) || strUA.match(/ipad/) || strUA.match(/android/) )
{
mobile = true;
function pointerX(event) {
var docElement = document.documentElement;
body = document.documentElement || document.body || { scrollLeft: 0 };
if (event.changedTouches) return (event.changedTouches[0].clientX +
(docElement.scrollLeft || body.scrollLeft) -
(docElement.clientLeft || 0));
return event.pageX || (event.clientX +
(docElement.scrollLeft || body.scrollLeft) -
(docElement.clientLeft || 0));
}
function pointerY(event) {
var docElement = document.documentElement;
body = document.documentElement || document.body || { scrollTop: 0 };
if (event.changedTouches) return (event.changedTouches[0].clientY +
(docElement.scrollLeft || body.scrollLeft) -
(docElement.clientLeft || 0));
return event.pageY || (event.clientY +
(docElement.scrollTop || body.scrollTop) -
(docElement.clientTop || 0));
}
}
// do_action
function do_action (act) {
self.location.href='?q='+act;
}
function ajax_eval( data, async )
{
if( async == null ) async = true;
if( !data.match(/&q=/) ) data = '&q='+data;
new Ajax.Request(connector, {
method: 'post',
postBody : data,
asynchronous : async,
onSuccess : function(obj){
if(obj.responseText){
eval(obj.responseText);
}
}
});
}
function ajax_eval_debug( data, async )
{
alert(connector);
alert(data);
if( async == null ) async = true;
if( !data.match(/&q=/) ) data = '&q='+data;
new Ajax.Request(connector, {
method: 'post',
postBody : data,
asynchronous : async,
onSuccess : function(obj){
alert(obj.responseText);
if(obj.responseText){
alert(obj.responseText);
eval(obj.responseText);
}
}
});
}
function ajax_json_eval( data ) {
if( !data.match(/&q=/) ) data = '&q='+data;
new Ajax.Request(connector, {
method: 'post',
postBody : data,
onSuccess : function(obj){
if(obj.responseText){
eval('ret='+obj.responseText);
if( ret.type == 'script' ) {
eval(ret.data);
} else {
//alert(obj.responseText);
}
}
}
});
}
function ajax_callback( data, func, async ) {
if( async == null ) async = true;
if( !data.match(/&q=/) ) data = '&q='+data;
new Ajax.Request(connector, {
method: 'post',
postBody : data,
asynchronous : async,
onSuccess : eval(func)
});
}
function ajax_update( data, elm ){
if( !data.match(/&q=/) ) data = '&q='+data;
new Ajax.Updater(
{success:elm},
connector, {
method: "post",
postBody : data,
evalScripts: true,
onFailure:function(httpObj){
$(elm).innerHTML = "Error!!";
}
}
);
}
function ajax_eval_p( data, async )
{
if( async == null ) async = true;
if( !data.match(/&a=/) ) { data = '&a='+data; }
new Ajax.Request('/index.php',
{
method: 'get',
parameters : data,
asynchronous : async,
onSuccess: function(obj) {
if(obj.responseText){
//alert(obj.responseText);
eval(obj.responseText);
}
}
});
}
function ajax_update_p( data, elm )
{
if( !data.match(/&q=/) ) data = '&a='+data;
new Ajax.Updater(
{success:elm},
'/index.php', {
method: "get",
parameters : data,
evalScripts: true,
onFailure:function(httpObj){
$(elm).innerHTML = "Error!!";
}
}
);
}
function ajax_submit_p(form_obj){
post_data = Form.serialize(form_obj);
new Ajax.Request('/index.php', {
method: 'post',
postBody : post_data,
onSuccess : function(obj){
if(obj.responseText){
eval(obj.responseText);
}
}
});
}
function ajax_dialog(data,x,y)
{
if( !data.match(/&q=/) ) data = '&q='+data;
if( !x ) x = 480;
if( !y ) y = 320;
Dialog.info(
{
url: connector,
options: {
method: 'post',
postBody : data,
asynchronous : false,
evalScripts: true
}
},
{
className:"alert",
width:x,
height:y
}
);
}
function ajax_submit(form_obj){
post_data = Form.serialize(form_obj);
new Ajax.Request(connector, {
method: 'post',
postBody : post_data,
onSuccess : function(obj){
if(obj.responseText){
eval(obj.responseText);
}
}
});
}
function ajax_submit_update( data, formelm, elm ) {
if( !!$('easy_html') && !!oEditor ) {
$('easy_html').value = oEditor.GetXHTML();
oEditor=null;
} else if ( !!$('cmp_html') && !!oEditor ) {
$('cmp_html').value = oEditor.GetXHTML();
oEditor=null;
}
if( !data.match(/&q=/) ) data = '&q='+data+'&'+Form.serialize(formelm);
new Ajax.Updater(
{success:elm},
connector, {
method: "post",
postBody : data,
evalScripts: true,
onFailure:function(httpObj){
$(elm).innerHTML = "Error!!";
}
}
);
return false;
}
function alert_dialog(msg, h, func) {
if( !h ) h = 100;
Dialog.alert(msg, {
windowParameters: {width:320, height:h, zIndex:1000000},
className:"alert",
okLabel: "OK",
ok: func
});
}
function alert_dialog_reload(msg, h) {
if( !h ) h = 100;
Dialog.alert(msg, {
windowParameters: {width:320, height:h, zIndex:1000000},
className:"alert",
okLabel: "OK",
ok: function(){ location.reload(); }
});
}
function confirm_dialog(msg, func, h) {
if( !h ) h = 100;
Dialog.confirm(msg, {
windowParameters: {width:320, height:h, zIndex:1000000, duration:0.1},
className:"alert",
okLabel: "OK",
ok:func,
cancel:function(){Dialog.closeInfo();}
});
}
function confirm_dialog_update(msg, data, elm, h) {
if( !h ) h = 100;
Dialog.confirm(msg, {
windowParameters: {width:320, height:h, zIndex:1000000},
className:"alert",
okLabel: "OK",
ok:function(){ajax_update(data,elm);Dialog.closeInfo();},
cancel:function(){Dialog.closeInfo();}
});
}
function info_dialog(msg, w, h, progress) {
if( !w ) w = 320;
if( !h ) w = 100;
if( progress !== false ) progress = true;
Dialog.info(msg, {
className:"alert",
windowParameters: {width:w, height:h, zIndex:1000000},
showProgress:progress
});
}
function sub_dialog(msg,x,y) {
if( !x ) x = 320;
if( !y ) y = 100;
Dialog.info(msg, {
className:"alert",
windowParameters: {width:x, height:y, zIndex:1000000},
showProgress:false
});
}
function close_dialog(msg) {
Dialog.setInfoMessage(msg);
setTimeout("Dialog.closeInfo()", 1500);
}
function set_message(msg){
Dialog.setInfoMessage(msg);
}
function set_size_dialog(w,h)
{
var winobj = self.Windows.getFocusedWindow();
if( winobj === null ) return;
winobj.setSize(w,h);
winobj.showCenter();
}
function toggle(elm)
{
if( Element.visible(elm) )
{
$(elm).hide();
}
else
{
$(elm).show();
}
}
function set_cookie(keyname, data, expire_flag)
{
theDay = 1;
setDay = new Date();
setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
expDay = setDay.toGMTString();
val = get_cookie(keyname);
if( val !== '' ) {
var re = new RegExp(keyname + "="+escape(val)+";");
document.cookie.replace(re,'');
}
if( !!expire_flag) {
document.cookie = keyname + "="+escape(data)+";expires=" + expDay + "; path=/";
} else {
document.cookie = keyname + "="+escape(data)+ "; path=/";
}
}
function get_cookie(keyname)
{
theData = "";
theName = keyname+"=";
theCookie = document.cookie+";";
start = theCookie.indexOf(theName);
if (start != -1)
{
end = theCookie.indexOf(";",start);
theData = unescape(theCookie.substring(start+theName.length,end));
}
return theData;
}
function open_dialog(url, x, y, title, status, modal, dialog_name, reload )
{
if( !url ) return false;
if( !x ) x = '540';
if( !y ) y = '480';
if( x.toString().match(/([0-9]+)%/) ) {
ratio = RegExp.$1 / 100;
x = Math.floor(get_brouser_width() * ratio);
}
if( x > get_brouser_width() ) {
x = Math.floor(get_brouser_width() * 0.95);
}
y = eval(y)+30;
if( !title ) title = '';
if( !status ) status = '';
if( !modal ) modal = true;
if( !dialog_name ) dialog_name = 'admin_dialog';
if( !reload ) reload = false;
var win = new Window(dialog_name,{
className: 'dialog',
destroyOnClose: true,
width:x,
height:y,
zIndex: 100000,
resizable: true,
minimizable: true,
maximizable: true,
title: title,
draggable:true,
wiredDrag: false,
showEffectOptions:{duration:0.1},
hideEffectOptions:{duration:0},
duration:0,
onResize:function(){
jQuery($('admin_dialog_content').contentWindow.document).find('iframe').each(function(){
if( this.id )
{
jQuery(this).height(jQuery('#admin_dialog_content').height()-jQuery(this).position().top);
}
});
},
onMaximize:function(){
//alert("OK");
jQuery($('admin_dialog_content').contentWindow.document).find('iframe').each(function(){
if( this.id )
{
jQuery(this).height(jQuery('#admin_dialog_content').height()-jQuery(this).position().top);
}
});
}
});
if( status ) win.setStatusBar(status);
if( !reload ) win.setCloseCallback(windowReload);
if( mobile )
{
win.show(modal);
} else {
win.showCenter(modal);
}
win.setURL(url);
set_cookie(cookie_first_url, url);
}
var reload_flag=false;
function windowReload()
{
if( reload_flag !== false )
{
if( reload_flag === 'ajax' )
{
info_dialog('更新中...', 200, 100, true);
new Ajax.Updater(
{success:'cms_contents_area'},
location.href, {
method: "get",
parameters : 'cmsmode=reload',
evalScripts: true,
onFailure:function(httpObj){
$(elm).innerHTML = "Error!!";
},
onSuccess:function(httpobj){
Dialog.closeInfo();
}
}
);
reload_flag = false;
} else if( reload_flag === true || reload_flag === 'reload' ) {
location.reload();
}
}
if( typeof context_menu == 'object' ) context_menu.init();
return true;
}
function windowClose()
{
return true;
}
var debug = {
win: null,
p: function(str){
if( !debug.win ) {
debug.o();
}
debug.win.document.write(str+"
");
},
o: function(){
debug.win = window.open('about:blank','debug','width=300,height=300,resizable=yes');
}
};
var target_element=null;
function showFileManager(dir, element_name){
if( !element_name ) element_name = null;
target_element = element_name;
var url = "/_administrator/editor/FCKeditor/editor/filemanager/browser/mcpuk/browser.html?Type=File&Connector=connectors/php/connector.php";
if( dir ){
url += '&CurrentFolder=' + dir.replace(/\/+/,"/");
}
x=800;
y=600;
OpenSubWin(url,x,y,'server_browser');
}
function showImageManager(dir, element_name){
if( !element_name ) element_name = null;
target_element = element_name;
var url = "/_administrator/editor/FCKeditor/editor/filemanager/browser/mcpuk/browser.html?Type=Image&Connector=connectors/php/connector.php";
if( dir ){
url += '&CurrentFolder=' + dir.replace(/\/+/,"/");
}
x=800;
y=600;
x = screen.width * .7;
y = (screen.height - 50) * .8;
OpenSubWin(url,x,y,'server_browser');
}
function SetUrl( fileUrl ){
if( !!target_element && !!$(target_element) ) {
$(target_element).value = fileUrl;
if(!!$(target_element).onchange) $(target_element).onchange();
} else if( !!context_menu && !!context_menu.easy_edit_mode ) {
context_menu.easy_edit_mode_image(fileUrl);
} else {
OpenSubWin(fileUrl,0,0,"image");
return true;
}
}
function OpenSubWin(url, x, y,winname ){
if( !url ) return false;
var option = '';
if( !mobile )
{
if( !x ) x = 600;
if( !y ) y = 480;
wx = screen.width;
wy = screen.height - 50;
dx = ( wx - x ) / 2;
dy = ( wy - y ) / 2;
option = "top=" + dy;
option += ",left=" + dx;
option += ",width=" + x;
option += ",height=" + y;
option += ",scrollbars=yes,status=yes,resizable=yes";
w = window.open(url,winname,option);
// w.moveTo(dx,dy);
w.focus();
}
else
{
window.open(url,winname,option);
}
}
function screenInfomation(){
var s = new Object();
s.width = parent.document.documentElement.clientWidth||parent.document.body.clientWidth; // 横幅
s.nowHeight = parent.document.documentElement.clientHeight; // 現在表示している画面の高さ
s.height = parent.document.documentElement.scrollHeight||parent.document.body.clientHeight; // 画面の高さ
s.x = parent.document.documentElement.scrollLeft||parent.document.body.scrollLeft; // 横の移動量
s.y = parent.document.documentElement.scrollTop||parent.document.body.scrollTop; // 縦の移動量
return s;
}
function get_brouser_height(){
// IE以外。
if (!document.all && (document.layers || document.getElementById)) {
return window.innerHeight;
}
// ウィンドウズIE 6・標準モード。
else if (document.getElementById && (document.compatMode=='CSS1Compat')) {
return document.documentElement.clientHeight;
}
// その他のIE。
else if (document.all) {
return document.body.clientHeight;
}
// その他(非対応)。
else {
return 800;
}
}
function get_brouser_width(){
// IE以外。
if (!document.all && (document.layers || document.getElementById)) {
return window.innerWidth;
}
// ウィンドウズIE 6・標準モード。
else if (document.getElementById && (document.compatMode=='CSS1Compat')) {
return document.documentElement.clientWidth;
}
// その他のIE。
else if (document.all) {
return document.body.clientWidth;
}
// その他(非対応)。
else {
return 1024;
}
}
function isNumeric(num){
var numeric="0123456789";
if(num.length==0){
return true;
}
for(i=0;i= 4 ) {
showLoginBox();
}
if( n === 2 )
{
touchnum++;
setTimeout(function(){
touchnum = 0;
},2000);
if( touchnum === 8 )
{
touchnum = 0;
showLoginBox();
}
}
}
}
function getKEYSTR(e){
if(document.all)
return event.keyCode
else if(document.getElementById)
return (e.keyCode!=0)?e.keyCode:e.charCode;
else if(document.layers)
return e.which;
}
function showLoginBox()
{
Dialog.info(
{
url: '/_administrator/connector.php',
options: {
method: 'get',
parameters: '&r='+location.protocol+'/'+'/'+location.hostname+location.pathname,
asynchronous : true,
}
},
{
id:"LoginDialog",
destroyOnClose: true,
className:"login",
width:420,
height:320,
zIndex:500,
effectOptions:{duration:0.5,afterFinish:function(){$('cms_admin_id').focus();}},
onClose: function(){
login_key=0
login_flag=0;
}
}
);
}
function loginsubmit()
{
if( !$("cms_admin_id").value || !$("cms_admin_password").value ){
$('login_error_msg').innerHTML='ID,パスワードが入力されていません。';
$('login_error_msg').show();
Windows.focusedWindow.updateHeight();
new Effect.Shake(Windows.focusedWindow.getId());
return false;
} else {
url = '/_administrator/connector.php?q=login';
var msec = (new Date()).getTime();
new Ajax.Request(url, {
method: "post",
postBody : "&username="+encodeURIComponent($("cms_admin_id").value)+"&password="+encodeURIComponent($("cms_admin_password").value),
onSuccess:function(httpObj){
eval(httpObj.responseText);
},
onFailure:function(httpObj){
$("login_error_msg").innerHTML = "エラーで読み込めませんでした";
}
});
return false;
}
return false;
}
function set_cookie(keyname, data)
{
theDay = 1;
setDay = new Date();
setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
expDay = setDay.toGMTString();
document.cookie = keyname + "="+escape(data)+"; expires=" + expDay + "; path=/;";
}
var preImage0 = new Image();preImage0.src="/_administrator/css/round/images/login/sp.gif";var preImage1 = new Image();preImage1.src="/_administrator/css/round/images/login/login_01.gif";var preImage2 = new Image();preImage2.src="/_administrator/css/round/images/login/login_02.gif";var preImage3 = new Image();preImage3.src="/_administrator/css/round/images/login/login_03.gif";var preImage4 = new Image();preImage4.src="/_administrator/css/round/images/login/login_button.gif";