﻿(function($) { $(window).load(function() { $.yuga.rollover(); $.yuga.thickbox(); $.yuga.scroll(); $.yuga.stripe(); $.yuga.css3class();}); $.yuga = { Uri: function(path){ var self = this; this.originalPath = path; this.absolutePath = (function(){ var e = document.createElement('span'); e.innerHTML = '<a href="' + path + '" />'; return e.firstChild.href;})(); var fields = {'schema' : 2, 'username' : 5, 'password' : 6, 'host' : 7, 'path' : 9, 'query' : 10, 'fragment' : 11}; var r = /^((\w+):)?(\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/.exec(this.absolutePath); for (var field in fields) { this[field] = r[fields[field]];}
this.querys = {}; if(this.query){ $.each(self.query.split('&'), function(){ var a = this.split('='); if (a.length == 2) self.querys[a[0]] = a[1];});}
}, selflink: function (options) { var c = $.extend({ selfLinkAreaSelector:'body', selfLinkClass:'current', parentsLinkClass:'parentsLink', postfix: '_on', changeImgSelf:true, changeImgParents:true
}, options); $(c.selfLinkAreaSelector+((c.selfLinkAreaSelector)?' ':'')+'a[href]').each(function(){ var href = new $.yuga.Uri(this.getAttribute('href')); var setImgFlg = false; if ((href.absolutePath == location.href) && !href.fragment) { $(this).addClass(c.selfLinkClass); setImgFlg = c.changeImgSelf;} else if (0 <= location.href.search(href.absolutePath)) { $(this).addClass(c.parentsLinkClass); setImgFlg = c.changeImgParents;}
if (setImgFlg){ $(this).find('img').each(function(){ this.originalSrc = $(this).attr('src'); this.currentSrc = this.originalSrc.replace(new RegExp('('+c.postfix+')?(\.gif|\.jpg|\.png)$'), c.postfix+"$2"); $(this).attr('src',this.currentSrc);});}
});}, rollover: function(options) { var c = $.extend({ hoverSelector: '.btn, .allbtn a img', groupSelector: '.btngroup', postfix: '_on'
}, options); var rolloverImgs = $(c.hoverSelector).filter(isNotCurrent); rolloverImgs.each(function(){ this.originalSrc = $(this).attr('src'); this.rolloverSrc = this.originalSrc.replace(new RegExp('('+c.postfix+')?(\.gif|\.jpg|\.png)$'), c.postfix+"$2"); this.rolloverImg = new Image; this.rolloverImg.src = this.rolloverSrc;}); var groupingImgs = $(c.groupSelector).find('img').filter(isRolloverImg); rolloverImgs.not(groupingImgs).hover(function(){ $(this).attr('src',this.rolloverSrc);},function(){ $(this).attr('src',this.originalSrc);}); $(c.groupSelector).hover(function(){ $(this).find('img').filter(isRolloverImg).each(function(){ $(this).attr('src',this.rolloverSrc);});},function(){ $(this).find('img').filter(isRolloverImg).each(function(){ $(this).attr('src',this.originalSrc);});}); function isNotCurrent(i){ return Boolean(!this.currentSrc);}
function isRolloverImg(i){ return Boolean(this.rolloverSrc);}
}, externalLink: function(options) { var c = $.extend({ windowOpen:true, externalClass: 'externalLink', addIconSrc: ''
}, options); var uri = new $.yuga.Uri(location.href); var e = $('a[href^="http://"]').not('a[href^="' + uri.schema + '://' + uri.host + '/' + '"]'); if (c.windowOpen) { e.click(function(){ window.open(this.href, '_blank'); return false;});}
if (c.addIconSrc) e.not(':has(img)').after($('<img src="'+c.addIconSrc+'" class="externalIcon" />')); e.addClass(c.externalClass);}, thickbox: function() { try { tb_init('a[href$=".jpg"]:not(.thickbox, a[href*="?"]), a[href$=".gif"][href!="?"]:not(.thickbox, a[href*="?"]), a[href$=".png"][href!="?"]:not(.thickbox, a[href*="?"])');} catch(e) { }
}, scroll: function(options) { var scroller = (function() { var c = $.extend({ easing:100, step:30, fps:60, fragment:''
}, options); c.ms = Math.floor(1000/c.fps); var timerId; var param = { stepCount:0, startY:0, endY:0, lastY:0
}; function move() { if (param.stepCount == c.step) { window.scrollTo(getCurrentX(), param.endY);} else if (param.lastY == getCurrentY()) { param.stepCount++; window.scrollTo(getCurrentX(), getEasingY()); param.lastY = getEasingY(); timerId = setTimeout(move, c.ms);} else { if (getCurrentY()+getViewportHeight() == getDocumentHeight()) { setFragment(param.hrefdata.absolutePath);}
}
}
function setFragment(path){ location.href = path
}
function getCurrentY() { return document.body.scrollTop || document.documentElement.scrollTop;}
function getCurrentX() { return document.body.scrollLeft || document.documentElement.scrollLeft;}
function getDocumentHeight(){ return document.documentElement.scrollHeight || document.body.scrollHeight;}
function getViewportHeight(){ return (!$.browser.safari && !$.browser.opera) ? document.documentElement.clientHeight || document.body.clientHeight || document.body.scrollHeight : window.innerHeight;}
function getEasingY() { return Math.floor(getEasing(param.startY, param.endY, param.stepCount, c.step, c.easing));}
function getEasing(start, end, stepCount, step, easing) { var s = stepCount / step; return (end - start) * (s + easing / (100 * Math.PI) * Math.sin(Math.PI * s)) + start;}
return { set: function(options) { this.stop(); if (options.startY == undefined) options.startY = getCurrentY(); param = $.extend(param, options); param.lastY = param.startY; timerId = setTimeout(move, c.ms);}, stop: function(){ clearTimeout(timerId); param.stepCount = 0;}
};})(); $('a[href^=#], area[href^=#]').not('a[href=#], area[href=#]').each(function(){ this.hrefdata = new $.yuga.Uri(this.getAttribute('href'));}).click(function(){ var target = $('#'+this.hrefdata.fragment); if (target.length == 0) target = $('a[name='+this.hrefdata.fragment+']'); if (target.length) { scroller.set({ endY: target.offset().top, hrefdata: this.hrefdata
}); return false;}
});}, tab: function(options) { var c = $.extend({ tabNavSelector:'.tabNav', activeTabClass:'active'
}, options); $(c.tabNavSelector).each(function(){ var tabNavList = $(this).find('a[href^=#], area[href^=#]'); var tabBodyList; tabNavList.each(function(){ this.hrefdata = new $.yuga.Uri(this.getAttribute('href')); var selecter = '#'+this.hrefdata.fragment; if (tabBodyList) { tabBodyList = tabBodyList.add(selecter);} else { tabBodyList = $(selecter);}
$(this).unbind('click'); $(this).click(function(){ tabNavList.removeClass(c.activeTabClass); $(this).addClass(c.activeTabClass); tabBodyList.hide(); $(selecter).show(); return false;});}); tabBodyList.hide()
tabNavList.filter(':first').trigger('click');});}, stripe: function(options) { var c = $.extend({ oddClass:'odd', evenClass:'even'
}, options); $('ul, ol').each(function(){ $(this).children('li:odd').addClass(c.evenClass); $(this).children('li:even').addClass(c.oddClass);}); $('table, tbody').each(function(){ $(this).children('tr:odd').addClass(c.evenClass); $(this).children('tr:even').addClass(c.oddClass);});}, css3class: function() { $('body :first-child').addClass('firstChild'); $('body :last-child').addClass('lastChild'); $('body :empty').addClass('empty');}
};})(jQuery); $(function(){ var currentstyle = readCookie('fontStyle'); if (currentstyle){ switchFont(currentstyle);}; $("a.sizeL").click(function(){ switchFont("fontL"); return false;}); $("a.sizeM").click(function(){ switchFont("fontM"); return false;}); $("a.sizeS").click(function(){ switchFont("fontS"); return false;});}); function switchFont(className){ $("body").removeAttr("class").addClass(className); createCookie('fontStyle', className, 365);}; function createCookie(name,value,days){ if (days){ var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString();}
else var expires = ""; document.cookie = name+"="+value+expires+"; path=/";}
function readCookie(name){ var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++)
{ var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);}
return null;}
new function(){ function heightLine(){ this.className="heightLine"; this.parentClassName="heightLineParent"
reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i"); objCN =new Array(); var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all; for(var i = 0; i < objAll.length; i++) { var eltClass = objAll[i].className.split(/\s+/); for(var j = 0; j < eltClass.length; j++) { if(eltClass[j] == this.className) { if(!objCN["main CN"]) objCN["main CN"] = new Array(); objCN["main CN"].push(objAll[i]); break;}else if(eltClass[j] == this.parentClassName){ if(!objCN["parent CN"]) objCN["parent CN"] = new Array(); objCN["parent CN"].push(objAll[i]); break;}else if(eltClass[j].match(reg)){ var OCN = eltClass[j].match(reg)
if(!objCN[OCN]) objCN[OCN]=new Array(); objCN[OCN].push(objAll[i]); break;}
}
}
var e = document.createElement("div"); var s = document.createTextNode("S"); e.appendChild(s); e.style.visibility="hidden"
e.style.position="absolute"
e.style.top="0"
document.body.appendChild(e); var defHeight = e.offsetHeight; changeBoxSize = function(){ for(var key in objCN){ if (objCN.hasOwnProperty(key)) { if(key == "parent CN"){ for(var i=0 ; i<objCN[key].length ; i++){ var max_height=0; var CCN = objCN[key][i].childNodes; for(var j=0 ; j<CCN.length ; j++){ if(CCN[j] && CCN[j].nodeType == 1){ CCN[j].style.height="auto"; max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;}
}
for(var j=0 ; j<CCN.length ; j++){ if(CCN[j].style){ var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], ''); var newheight = max_height; if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px",""); if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px",""); if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px",""); if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px",""); CCN[j].style.height =newheight+"px";}
}
}
}else{ var max_height=0; for(var i=0 ; i<objCN[key].length ; i++){ objCN[key][i].style.height="auto"; max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;}
for(var i=0 ; i<objCN[key].length ; i++){ if(objCN[key][i].style){ var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], ''); var newheight = max_height; if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px",""); if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px",""); if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","")
if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px",""); objCN[key][i].style.height =newheight+"px";}
}
}
}
}
}
checkBoxSize = function(){ if(defHeight != e.offsetHeight){ changeBoxSize(); defHeight= e.offsetHeight;}
}
changeBoxSize(); setInterval(checkBoxSize,1000)
window.onresize=changeBoxSize;}
function addEvent(elm,listener,fn){ try{ elm.addEventListener(listener,fn,false);}catch(e){ elm.attachEvent("on"+listener,fn);}
}
addEvent(window,"load",heightLine);}

