﻿
window.onDOMLoadEvents=new Array();window.DOMContentLoadedInitDone=false;
function addDOMLoadEvent(listener){window.onDOMLoadEvents[window.onDOMLoadEvents.length]=listener}
function DOMContentLoadedInit(){if(window.DOMContentLoadedInitDone) return;window.DOMContentLoadedInitDone=true;var exceptions=new Array();for(var i=0;i<window.onDOMLoadEvents.length;i++){var func=window.onDOMLoadEvents[i];try{func()} catch(e){exceptions[exceptions.length]=e}}
for(var i=0;i<exceptions.length;i++){throw exceptions[i]}}
function DOMContentLoadedScheduler(){if(window.DOMContentLoadedInitDone) return true;if(/KHTML|WebKit/i.test(navigator.userAgent)){if(/loaded|complete/.test(document.readyState)){DOMContentLoadedInit()} else{setTimeout("DOMContentLoadedScheduler()",250)}} else{setTimeout("DOMContentLoadedScheduler()",250)}
return true}
setTimeout("DOMContentLoadedScheduler()",250);if(window.addEventListener){window.addEventListener("load",DOMContentLoadedInit,false);document.addEventListener("DOMContentLoaded",DOMContentLoadedInit,false)} else if(window.attachEvent){window.attachEvent("onload",DOMContentLoadedInit)} else{var _dummy=function(){var $old_onload=window.onload;window.onload=function(e){DOMContentLoadedInit();$old_onload()}}}


// check for ie5 mac
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    &&
    navigator.userAgent.indexOf('Mac') != -1
)

// check for W3CDOM compatibility
var W3CDOM = (!bugRiddenCrashPronePieceOfJunk &&
               typeof document.getElementsByTagName != 'undefined' &&
               typeof document.createElement != 'undefined' );

// cross browser function for registering event handlers
var registerEventListener = null;

if (typeof addEvent != 'undefined') {
    // use Dean Edwards' function if available
    registerEventListener = function (elem, event, func) {
        addEvent(elem, event, func);
        return true;
    }
} else if (window.addEventListener) {
    registerEventListener = function (elem, event, func) {
        elem.addEventListener(event, func, false);
        return true;
    }
} else if (window.attachEvent) {
    registerEventListener = function (elem, event, func) {
        var result = elem.attachEvent("on"+event, func);
        return result;
    }
} else {
    registerEventListener = function (elem, event, func) {
        // maybe we could implement something with an array
        return false;
    }
}

function walkTextNodes(node, func, data) {
    // traverse childnodes and call func when a textnode is found
    if (!node){return false}
    if (node.hasChildNodes) {
        // we can't use for (i in childNodes) here, because the number of
        // childNodes might change (higlightsearchterms)
        for (var i=0;i<node.childNodes.length;i++) {
            walkTextNodes(node.childNodes[i], func, data);
        }
        if (node.nodeType == 3) {
            // this is a text node
            func(node, data);
        }
    }
};


// cross browser function for unregistering event handlers
var unRegisterEventListener = null;

if (typeof removeEvent != 'undefined') {
    // use Dean Edwards' function if available
    unRegisterEventListener = function (elem, event, func) {
        removeEvent(element, event, func);
        return true;
    }
} else if (window.removeEventListener) {
    unRegisterEventListener = function (elem, event, func) {
        elem.removeEventListener(event, func, false);
        return true;
    }
} else if (window.detachEvent) {
    unRegisterEventListener = function (elem, event, func) {
        var result = elem.detachEvent("on"+event, func);
        return result;
    }
} else {
    unRegisterEventListener = function (elem, event, func) {
        // maybe we could implement something with an array
        return false;
    }
}

var registerPloneFunction = null;

if (typeof addDOMLoadEvent != 'undefined') {
    registerPloneFunction = function (func) {
        // registers a function to fire ondomload.
        addDOMLoadEvent(func);
    }
} else {
    registerPloneFunction = function (func) {
        // registers a function to fire onload.
        registerEventListener(window, "load", func);
    }
}




/* - se-highlight.js - */

function getContentArea() {
    // returns our content area element
    if (W3CDOM) {
        var node = document.getElementById('container');
        if (!node) {
            node = document.getElementById('container');
        }
        return node;
    }
}  

var searchEngines = [
    ['^http://([^.]+\\.)?google.*', 'q='],              // Google
    ['^http://search\\.yahoo.*', 'p='],                // Yahoo
    ['^http://search\\.msn.*', 'q='],                  // MSN
    ['^http://search\\.aol.*', 'userQuery='],          // AOL
    ['^http://(www\\.)?altavista.*', 'q='],            // AltaVista
    ['^http://(www\\.)?feedster.*', 'q='],             // Feedster
    ['^http://search\\.lycos.*', 'query='],            // Lycos
    ['^http://(www\\.)?alltheweb.*', 'q='],             // AllTheWeb
    ['^http://(www\\.)?ask\\.com.*', 'q=']                   // Ask.com
]

function decodeReferrer(ref) {
    // checks if we are beeing searched by a search engine
    if (null == ref && document.referrer) {
        ref = document.referrer;
    }
    if (!ref) return null;

    var match = new RegExp('');
    var seQuery = '';
    for (var i = 0; i < searchEngines.length; i ++) {
        if (!match.compile) {
            // Safari doesn't support the non-standard compile method
            match = new RegExp(searchEngines[i][0], 'i');
        } else {
            match.compile(searchEngines[i][0], 'i');
        }
        if (ref.match(match)) {
            
            if (!match.compile) {
                match = new RegExp('^.*[?&]'+searchEngines[i][1]+'([^&]+)&?.*$', 'i');
            } else {
                match.compile('^.*[?&]'+searchEngines[i][1]+'([^&]+)&?.*$');
            }
            seQuery = ref.replace(match, '$1');
            if (seQuery) {
				try {
					seQuery = decodeURIComponent(seQuery);
					seQuery = seQuery.replace(/\'|"/, '');
					return seQuery.split(/[\s,\+\.]+/);
				} catch(e) {
					
				}
            }

        }
    }
    return null;
}

function highlightTermInNode(node, word) {
	var contents = node.nodeValue;
	var index = contents.toLowerCase().indexOf(word.toLowerCase());
	if (index < 0){return false};

	var parent = node.parentNode;
	if (parent.className != "highlightedSearchTerm") {
	    // make 3 shiny new nodes
	    var hiword = document.createElement("span");
	        hiword.className = "highlightedSearchTerm";
	        hiword.appendChild(document.createTextNode(contents.substr(index, word.length)));
	        parent.insertBefore(document.createTextNode(contents.substr(0, index)), node);
	        parent.insertBefore(hiword, node);
	        parent.insertBefore(document.createTextNode(contents.substr(index+word.length)), node);
	        parent.removeChild(node);
    }
}

function highlightSearchTerms(terms, startnode) {
    // terminate if we hit a non-compliant DOM implementation
    if (!W3CDOM){return false};
    if (!terms){return false};
    if (!startnode){return false};

    for (var term_index=0; term_index < terms.length; term_index++) {
        // don't highlight reserved catalog search terms
        var term = terms[term_index];
        var term_lower = term.toLowerCase();
        if (term_lower != 'not'
            && term_lower != 'and'
            && term_lower != 'or') {
            walkTextNodes(startnode, highlightTermInNode, term);
        }
    }
}

function getSearchTermsFromURI(uri) {
    var query;
    if (typeof decodeURI != 'undefined') {
        query = decodeURI(uri);
    } else if (typeof unescape != 'undefined') {
        // _robert_ ie 5 does not have decodeURI
        query = unescape(uri);
    } else {
        // we just try to be lucky, for single words this will still work
    }
    var result = new Array();
    if (window.decodeReferrer) {
        var referrerSearch = decodeReferrer();
        if (null != referrerSearch && referrerSearch.length > 0) {
            result = referrerSearch;
        }
    }
    var qfinder = new RegExp("searchterm=([^&]*)", "gi");
    var qq = qfinder.exec(query);
    if (qq && qq[1]) {
        var terms = qq[1].replace(/\+/g,' ').split(/\s+/);
        for (var i=0; i < terms.length; i++) {
            if (terms[i] != '') {
                result.push(terms[i]);
            }
        }
        return result;
    }
    return result.length == 0 ? false : result;
}

var flgExistKeywordImages = false;
var flgExistKeywordTexts = false;

function highlightSearchTermsFromURI() {
    // terminate if we hit a non-compliant DOM implementation
    if (!W3CDOM){return false};
	
    // search-term-highlighter function --  Geir BÃŠkholt
    var terms = getSearchTermsFromURI(window.location.search);
    // make sure we start the right place so we don't higlight menuitems or breadcrumb
    var contentarea = getContentArea();
	
	// hilighten keywords
    highlightSearchTerms(terms, contentarea);
	var tagSpans = document.getElementsByTagName('span');
	for (i=0; i < tagSpans.length; i++) {
		if (tagSpans[i].className == 'highlightedSearchTerm') {
			flgExistKeywordTexts = true;
		}
	}
	
	// search & blink images
	serchAltImages(terms);
	
	// show guide panel	
	if((flgExistKeywordTexts)||(altImages.length > 0)){
		showGuidePanel(terms);
	}
}


var tagSpansHighlight = new Array();
var flgSpansHighlight = true;
function switchHilighteSearchTerms() {
	if(flgSpansHighlight) {
		if(tagSpansHighlight.length == 0 ) {
			var tagSpans = document.getElementsByTagName('span');
			for (i=0; i < tagSpans.length; i++) {
				if (tagSpans[i].className == 'highlightedSearchTerm') {
					tagSpansHighlight[tagSpansHighlight.length] = tagSpans[i];
				}
			}
		}
		for (i=0; i < tagSpansHighlight.length; i++) {
			tagSpansHighlight[i].style.fontWeight = "normal";
			tagSpansHighlight[i].style.background = "none";
			tagSpansHighlight[i].fontSize = "80%";
		}
		flgSpansHighlight = false;
	} else {
		for (i=0; i < tagSpansHighlight.length; i++) {
			tagSpansHighlight[i].style.fontWeight = "bold";
			tagSpansHighlight[i].style.background = "#FFFF00";
			tagSpansHighlight[i].fontSize = "120%";
		}
		flgSpansHighlight = true;
	}
}



//search alt images
var altImages = new Array();
function serchAltImages(terms) {
	var tagImgs = document.getElementsByTagName("img");
	if(tagImgs.length > 0){
		for (i=0; i < tagImgs.length; i++) {
			var tempAltText = tagImgs[i].getAttribute("alt");
			var flgWordExist = false;
			if (tempAltText) {
				for (j=0; j < terms.length; j++) {
					if(tempAltText.indexOf(terms[j]) > -1) {
						flgWordExist = true;
					}
				}
			}
			if(flgWordExist) {
				altImages[altImages.length] = tagImgs[i];
			}
		}
	}
}


function markingImages() {
	drawLineImages();
	//blinkImages();
}


// draw line search alt images
var markersTop = new Array();
var markersRight = new Array();
var markersBottom = new Array();
var markersLeft = new Array();
var borderColor = "#FFFF00";
var borderSize = 2;

function drawLineImages() {
	if(altImages.length > 0) {
		if(markersTop.length > 0) {
			for (i=0; i < altImages.length; i++) {
				markersTop[i].style.top = altImages[i].offsetTop + "px";
				markersTop[i].style.left = altImages[i].offsetLeft + "px";
				markersRight[i].style.top = altImages[i].offsetTop + "px";
				markersRight[i].style.left = (altImages[i].offsetLeft + altImages[i].offsetWidth - (borderSize * 2)) + "px";
				markersBottom[i].style.top = (altImages[i].offsetTop + altImages[i].offsetHeight - borderSize) + "px";
				markersBottom[i].style.left = (altImages[i].offsetLeft + borderSize) + "px";
				markersLeft[i].style.top = (altImages[i].offsetTop + borderSize) + "px";
				markersLeft[i].style.left = altImages[i].offsetLeft + "px";
			}
		} else {
			for (i=0; i < altImages.length; i++) {
				altImages[i].style.position = 'relative';
				
				var markerTop = document.createElement("div");
				markerTop.className = "conductorAltImageMarkerTop";
				markerTop.style.display = "block";
				markerTop.style.position = "absolute";
				markerTop.style.top = altImages[i].offsetTop + "px";
				markerTop.style.left = altImages[i].offsetLeft + "px";
				markerTop.style.width = (altImages[i].offsetWidth - borderSize) + "px";
				markerTop.style.height = borderSize + "px";
				markerTop.style.borderTop = borderSize + "px solid " + borderColor;
				
				var markerRight = document.createElement("div");
				markerRight.className = "conductorAltImageMarkerTop";
				markerRight.style.display = "block";
				markerRight.style.position = "absolute";
				
				markerRight.style.top = altImages[i].offsetTop + "px";
				markerRight.style.left = (altImages[i].offsetLeft + altImages[i].offsetWidth - (borderSize * 2)) + "px";
				markerRight.style.width = borderSize + "px";
				markerRight.style.height = (altImages[i].offsetHeight - borderSize) + "px";
				markerRight.style.borderRight = borderSize + "px solid " + borderColor;
				
				var markerBottom = document.createElement("div");
				markerBottom.className = "conductorAltImageMarkerTop";
				markerBottom.style.display = "block";
				markerBottom.style.position = "absolute";
				markerBottom.style.top = (altImages[i].offsetTop + altImages[i].offsetHeight - borderSize) + "px";
				markerBottom.style.left = (altImages[i].offsetLeft + borderSize) + "px";
				markerBottom.style.width = (altImages[i].offsetWidth - borderSize) + "px";
				markerBottom.style.height = borderSize + "px";
				markerBottom.style.borderTop = borderSize + "px solid " + borderColor;
				
				var markerLeft = document.createElement("div");
				markerLeft.className = "conductorAltImageMarkerTop";
				markerLeft.style.display = "block";
				markerLeft.style.position = "absolute";
				markerLeft.style.top = (altImages[i].offsetTop + borderSize) + "px";
				markerLeft.style.left = altImages[i].offsetLeft + "px";
				markerLeft.style.width = borderSize + "px";
				markerLeft.style.height = (altImages[i].offsetHeight - borderSize) + "px";
				markerLeft.style.borderLeft = borderSize + "px solid " + borderColor;
				
				
				var objBody = document.getElementsByTagName("body").item(0);
				
				objBody.appendChild(markerTop);
				markersTop[markersTop.length] = markerTop;
				
				objBody.appendChild(markerRight);
				markersRight[markersRight.length] = markerRight;
				
				objBody.appendChild(markerBottom);
				markersBottom[markersBottom.length] = markerBottom;
				
				objBody.appendChild(markerLeft);
				markersLeft[markersLeft.length] = markerLeft;
			}
		}
	}
}

var flgDrawLineImages = true;
function switchDrawLineImages() {
	if(flgDrawLineImages){
		if(markersTop.length > 0) {
			for (i=0; i < altImages.length; i++) {
				markersTop[i].style.display = "none";
				markersRight[i].style.display = "none";
				markersBottom[i].style.display = "none";
				markersLeft[i].style.display = "none";
			}
		}
		flgDrawLineImages = false;
	} else {
		if(markersTop.length > 0) {
			for (i=0; i < altImages.length; i++) {
				markersTop[i].style.display = "block";
				markersRight[i].style.display = "block";
				markersBottom[i].style.display = "block";
				markersLeft[i].style.display = "block";
			}
		}
		flgDrawLineImages = true;
	}
}


// blink search alt images
var opacityValue = 10;
var flgToThin = true;
var intInterval = 50;
function blinkImages() {
	if(flgBlinkImage) {
		if(altImages.length > 0) {
			for (i=0; i < altImages.length; i++) {
				altImages[i].style.filter = 'alpha(opacity=' + (opacityValue * 10) + ')';
				altImages[i].style.MozOpacity = opacityValue / 10;
				altImages[i].style.opacity = opacityValue / 10;
			}
			if(flgToThin) {
				if(opacityValue > 0){
					opacityValue -= 1;
				} else {
					flgToThin = false;
				}
				setTimeout('blinkImages()',intInterval);
			} else {
				if(opacityValue < 10){
					opacityValue += 1;
				} else {
					flgToThin = true;
				}
				setTimeout('blinkImages()',intInterval);
			}
		}
	} else {
		opacityValue = 10;
		if(altImages.length > 0) {
			for (i=0; i < altImages.length; i++) {
				altImages[i].style.filter = 'alpha(opacity=' + (opacityValue * 10) + ')';
				altImages[i].style.MozOpacity = opacityValue / 10;
				altImages[i].style.opacity = opacityValue / 10;
			}
		}
	}
}

var flgBlinkImage = false;
function switchBlinkImages() {
	if(flgBlinkImage) {
		flgBlinkImage = false;
	} else {
		flgBlinkImage = true;
		blinkImages();
	}
}



//search outpage keywords
var flgGuidePanelState = 1;	//0:close, 1:maxmize, 2:default, 3:minimize

var numMaxBottom = 0;
var keyword = "";
var guide = new Object;

function showGuidePanel(terms) {
	if(terms.length > 0){
		if (flgGuidePanelState > 0) {
			
			if(terms) {
				for (i=0; i < terms.length; i++) {
					var tempText = '「' + terms[i] + '」'
					keyword += tempText;
				}
			}
			
			guide = document.getElementById("conductorguide");
			if(guide == null) {
				createGuidePanel();
			}
			
			searchOutpageKeywordsCheck();
		}
	}
}

function searchOutpageKeywordsCheck() {
	
	var scrollPositon = getScrollPosition();
	var screenSize = getScreenSize();
	var offsetPosition = guide.offsetHeight + 10;
	
	if(guide.offsetTop < (scrollPositon.y + screenSize.y - offsetPosition)) {
		guide.style.top = (((scrollPositon.y + screenSize.y - offsetPosition) - guide.offsetTop ) / 2) + guide.offsetTop + "px";
	} else if (guide.offsetTop >= (scrollPositon.y + screenSize.y - offsetPosition)) {
		guide.style.top = (guide.offsetTop - ((guide.offsetTop - (scrollPositon.y + screenSize.y - offsetPosition)) / 2)) + "px";
	}
	guide.style.filter = 'alpha(opacity=' + (intGuidePanelOpacityValue * 10) + ')';
	guide.style.MozOpacity = intGuidePanelOpacityValue / 10;
	guide.style.opacity = intGuidePanelOpacityValue / 10;
	
	if (flgGuidePanelState == 0) {
		if (intGuidePanelOpacityValue > 0) {
			setTimeout( function(){searchOutpageKeywordsCheck()},50);
			intGuidePanelOpacityValue -= 1;
			if(intGuidePanelOpacityValue == 0){
				guide.style.display = 'none';	
			}
		}
	} else {
		setTimeout( function(){searchOutpageKeywordsCheck()},50);	
	}	
}


/*
-------------------------------------*/

var baseHtml = '';
var spanHighlightHtml = '';
var blinkImageHtml = '';
var drawLineImagesHtml = '';
var intGuidePanelOpacityValue = 8;

function createGuidePanel() {
	
	guide = document.createElement("div");
	guide.id = "conductorguide";
	guide.style.position = "absolute";
	guide.style.top = "0px";
	guide.style.right = "10px";
	guide.style.display ="block";
	guide.style.width = "180px";
	guide.style.padding = "5px";
	guide.style.textAlign ="left";
	guide.style.lineHeight = "120%";
	guide.style.fontWeight = "normal";
	guide.style.backgroundColor = "#FFFFFF";
	guide.style.zIndex = "10";
	
	guide.style.filter = 'alpha(opacity=' + (intGuidePanelOpacityValue * 10) + ')';
	guide.style.MozOpacity = intGuidePanelOpacityValue / 10;
	guide.style.opacity = intGuidePanelOpacityValue / 10;
	
	switchGuidePanelHtml();
	
	var objBody = document.getElementsByTagName("body").item(0);
	objBody.appendChild(guide);
}

function switchGuidePanelHtml() {
	
	baseHtml = '';
	spanHighlightHtml = '';
	blinkImageHtml = '';
	drawLineImagesHtml = '';
	
	switch (flgGuidePanelState) {
		case 0:
			//close
			break;
			
		case 1:
			//maxmize
			guide.style.width = "180px";
			
			baseHtml += '<div style="float:left"><a href="http://lpo.axyz.co.jp/?htc" target="_blank"><img src="http://lpo.axyz.co.jp/common/img/panel_titile.gif" style="padding-top:3px;"></a></div>';
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=0" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_close.gif" style="padding:0 1px;"></a>';
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=2;switchGuidePanelHtml();" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_defwindow.gif" style="padding:0 1px;"></a>';
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=3;switchGuidePanelHtml();" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_minimize.gif" style="padding:0 1px;"></a>';
			baseHtml += '<div style="clear:both;padding:10px 0;line-height:110%;">検索キーワード<b>' + keyword + '</b>に関連するページ内コンテンツを自動でピックアップしています。通常時は<a href="' + location.href + '?kht" style="text-decoration:underline">このように</a>表示されます。</div>';
			
			if (flgSpansHighlight) {
				spanHighlightHtml = '<div><a href="javascript:void(0)" onClick="switchHilighteSearchTerms();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_markingkeywords.gif" align="absbottom" style="padding-right:2px" alt="キーワードハイライト ON" title="キーワードハイライト ON" /><b>キーワードハイライト ON</b></a></div>';
			} else {
				spanHighlightHtml = '<div><a href="javascript:void(0)" onClick="switchHilighteSearchTerms();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_markingkeywords_off.gif" align="absbottom" style="padding-right:2px" alt="キーワードハイライト OFF" title="キーワードハイライト OFF" /><b style="color:#999999">キーワードハイライト OFF</b></a></div>';	
			}
			
			if (flgBlinkImage) {
				blinkImageHtml = '<div><a href="javascript:void(0)" onClick="switchBlinkImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_blinkimage.gif" align="absbottom" style="padding-right:2px" alt="関連画像の点滅 ON" title="関連画像の点滅 ON" /><b>関連画像の点滅 ON</b></a></div>';
			} else {
				blinkImageHtml = '<div><a href="javascript:void(0)" onClick="switchBlinkImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_blinkimage_off.gif" align="absbottom" style="padding-right:2px" alt="関連画像の点滅 OFF" title="関連画像の点滅 OFF" /><b style="color:#999999">関連画像の点滅 OFF</b></a></div>';
			}
			
			if(flgDrawLineImages) {
				drawLineImagesHtml = '<div><a href="javascript:void(0)" onClick="switchDrawLineImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_drawlineimage.gif" align="absbottom" style="padding-right:2px" alt="関連画像マーキング ON" title="関連画像マーキング ON" /><b>関連画像マーキング ON</b></a></div>';
			} else {
				drawLineImagesHtml = '<div><a href="javascript:void(0)" onClick="switchDrawLineImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_drawlineimage_off.gif" align="absbottom" style="padding-right:2px" alt="関連画像マーキング OFF" title="関連画像マーキング OFF" /><b style="color:#999999">関連画像マーキング OFF</b></a></div>';	
			}
			
			break;
			
		case 2:
			//default
			guide.style.width = "180px";
			
			baseHtml += '<div style="float:left"><a href="http://lpo.axyz.co.jp/?htc" target="_blank"><img src="http://lpo.axyz.co.jp/common/img/panel_titile.gif" style="padding-top:3px;"></a></div>';
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=0" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_close.gif" style="padding:0 1px;"></a>';
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=1;switchGuidePanelHtml();" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_maxwindow.gif" style="padding:0 1px;"></a>';
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=3;switchGuidePanelHtml();" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_minimize.gif" style="padding:0 1px;"></a>';
			baseHtml += '<div style="clear:both;padding:10px 0;"><b>' + keyword + '</b></div>';
			
			if (flgSpansHighlight) {
				spanHighlightHtml = '<a href="javascript:void(0)" onClick="switchHilighteSearchTerms();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_markingkeywords.gif" align="absbottom" style="padding-right:2px" alt="キーワードハイライト ON" title="キーワードハイライト ON" /></a>';
			} else {
				spanHighlightHtml = '<a href="javascript:void(0)" onClick="switchHilighteSearchTerms();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_markingkeywords_off.gif" align="absbottom" style="padding-right:2px" alt="キーワードハイライト OFF" title="キーワードハイライト OFF" /></a>';	
			}
			
			if (flgBlinkImage) {
				blinkImageHtml = '<a href="javascript:void(0)" onClick="switchBlinkImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_blinkimage.gif" align="absbottom" style="padding-right:2px" alt="関連画像の点滅 ON" title="関連画像の点滅 ON" /></a>';
			} else {
				blinkImageHtml = '<a href="javascript:void(0)" onClick="switchBlinkImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_blinkimage_off.gif" align="absbottom" style="padding-right:2px" alt="関連画像の点滅 OFF" title="関連画像の点滅 OFF" /></a>';
			}
			
			if(flgDrawLineImages) {
				drawLineImagesHtml = '<a href="javascript:void(0)" onClick="switchDrawLineImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_drawlineimage.gif" align="absbottom" style="padding-right:2px" alt="関連画像マーキング ON" title="関連画像マーキング ON" /></a>';
			} else {
				drawLineImagesHtml = '<a href="javascript:void(0)" onClick="switchDrawLineImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_drawlineimage_off.gif" align="absbottom" style="padding-right:2px" alt="関連画像マーキング OFF" title="関連画像マーキング OFF" /></a>';	
			}
		
			break;
			
		case 3:
			//minimize
			guide.style.width = "54px";
			
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=0" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_close.gif" style="padding:0 1px;"></a>';
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=1;switchGuidePanelHtml();" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_maxwindow.gif" style="padding:0 1px;"></a>';
			baseHtml += '<a href="Javascript:void(0)" onClick="flgGuidePanelState=3;switchGuidePanelHtml();" style="float:right;"><img src="http://lpo.axyz.co.jp/common/img/panel_bar_minimize.gif" style="padding:0 1px;"></a><div style="clear:both;padding-top:5px;text-align:right;">';
			
			if (flgSpansHighlight) {
				spanHighlightHtml = '<a href="javascript:void(0)" onClick="switchHilighteSearchTerms();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_markingkeywords.gif" align="absbottom" style="padding-right:2px" alt="キーワードハイライト ON" title="キーワードハイライト ON" /></a>';
			} else {
				spanHighlightHtml = '<a href="javascript:void(0)" onClick="switchHilighteSearchTerms();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_markingkeywords_off.gif" align="absbottom" style="padding-right:2px" alt="キーワードハイライト OFF" title="キーワードハイライト OFF" /></a>';	
			}
			
			if (flgBlinkImage) {
				blinkImageHtml = '<a href="javascript:void(0)" onClick="switchBlinkImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_blinkimage.gif" align="absbottom" style="padding-right:2px" alt="関連画像の点滅 ON" title="関連画像の点滅 ON" /></a>';
			} else {
				blinkImageHtml = '<a href="javascript:void(0)" onClick="switchBlinkImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_blinkimage_off.gif" align="absbottom" style="padding-right:2px" alt="関連画像の点滅 OFF" title="関連画像の点滅 OFF" /></a>';
			}
			
			if(flgDrawLineImages) {
				drawLineImagesHtml = '<a href="javascript:void(0)" onClick="switchDrawLineImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_drawlineimage.gif" align="absbottom" style="padding-right:2px" alt="関連画像マーキング ON" title="関連画像マーキング ON" /></a></div>';
			} else {
				drawLineImagesHtml = '<a href="javascript:void(0)" onClick="switchDrawLineImages();switchGuidePanelHtml();"><img src="http://lpo.axyz.co.jp/common/img/panel_icon_drawlineimage_off.gif" align="absbottom" style="padding-right:2px" alt="関連画像マーキング OFF" title="関連画像マーキング OFF" /></a></div>';	
			}
			
			break;
			
		default:
			break;
	}
	
	if(!flgExistKeywordTexts){
		spanHighlightHtml = '';
	}
	if(altImages.length == 0){
		blinkImageHtml = '';
		drawLineImagesHtml = '';
	}
	guide.innerHTML = baseHtml + spanHighlightHtml + blinkImageHtml + drawLineImagesHtml;
}



function getElementPosition(element) {
	var objectTopPosition = 0;
	if (isIE()) {
		var tempElement = element.parentElement;
		var tempTagname = element.parentElement.tagName;
		objectTopPosition = tempElement.offsetTop;
		while (tempTagname != "BODY") {
			tempElement = tempElement.parentElement;
			tempTagname = tempElement.parentElement.tagName;
			objectTopPosition += tempElement.offsetTop;
		}
	} else if (isGecko()) {
		objectTopPosition = element.offsetTop;
	} else if (isOpera()) {
		objectTopPosition = element.offsetTop;
	} else if (isSafari()) {
		objectTopPosition = element.offsetTop;
	}
	
	return objectTopPosition;
}

function getPageSize(){

	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		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;
	if (self.innerHeight) {	// all except Explorer
		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;
	}
	
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	
	arrayPageSize = new Array(pageWidth,pageHeight) 
	return arrayPageSize;
}

//get scroll
function getScrollPosition() {
	var obj = new Object();
	obj.x = document.documentElement.scrollLeft || document.body.scrollLeft;
	obj.y = document.documentElement.scrollTop || document.body.scrollTop;
	return obj;
}

//get window size
function getScreenSize() {
	var isWin9X = (navigator.appVersion.toLowerCase().indexOf('windows 98')+1);
	var isIE = (navigator.appName.toLowerCase().indexOf('internet explorer')+1?1:0);
	var isOpera = (navigator.userAgent.toLowerCase().indexOf('opera')+1?1:0);
	if (isOpera) isIE = false;
	var isSafari = (navigator.appVersion.toLowerCase().indexOf('safari')+1?1:0);

	var obj = new Object();
	if (!isSafari && !isOpera) {
		obj.x = document.documentElement.clientWidth || document.body.clientWidth || document.body.scrollWidth;
		obj.y = document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight;
	} else {
		obj.x = window.innerWidth;
		obj.y = window.innerHeight;
	}
	obj.mx = parseInt((obj.x)/2);
	obj.my = parseInt((obj.y)/2);
	return obj;
}

//get document size
function getDocumentSize() {
	document.body.offsetWidth;
	document.body.offsetHeight;
}

//judge Gekko
function isGecko(){
    if(navigator){
        if(navigator.userAgent){
            if(navigator.userAgent.indexOf("Gecko/") != -1){
                return true;
            }
        }
    }
    return false;
}

//judge IE
function isIE(){
    if(navigator){
        if(navigator.appName){
            if(navigator.appName.toLowerCase().indexOf('internet explorer')+1 != 0){
                return true;
            }
        }
    }
    return false;
}

//judge Opera
function isOpera(){
    if(navigator){
        if(navigator.userAgent){
            if(navigator.appVersion.toLowerCase().indexOf('safari')+1 != 0){
                return true;
            }
        }
    }
    return false;
}

//judge Safari
function isSafari(){
    if(navigator){
        if(navigator.userAgent){
            if(navigator.userAgent.toLowerCase().indexOf('opera')+1 != 0){
                return true;
            }
        }
    }
    return false;
}



registerPloneFunction(highlightSearchTermsFromURI);
registerPloneFunction(markingImages);

window.onresize = function onResizeMarkingImages(){markingImages();}










