/*	matrix */
var host = (("https:" == document.location.protocol) ? "/~itnext-co-jp/" : "/");
var siteMatrix = host + "matrix";



/*  byon.js difference  */
var dif = 0;



/*	mac firefox */
var isMac = (navigator.appVersion.indexOf("Mac") != -1);
var agent = navigator.userAgent.toLowerCase() ;
var isFF2 = agent.indexOf("firefox/2") != -1;



(function(){
	//if(!/MSIE (5\.5|6\.|7\.|8\.)/.test(navigator.userAgent)) return;
	if(!/MSIE (5\.5|6\.)/.test(navigator.userAgent)) return;
	document.open();
	if("http:" == document.location.protocol){
		document.write('<link rel="stylesheet" type="text/css" href="' + siteMatrix + '/css/ie6.css">');
	} else {
		document.write('<link rel="stylesheet" type="text/css" href="' + siteMatrix + '/css/ie6_s.css">');
	}
	document.close();
}());




/*
 * IE PNG Fix v1.4
 *
 * Copyright (c) 2006 Takashi Aida http://www.isella.com/aod2/
 *
 */

// IE5.5+ PNG Alpha Fix v1.0RC4
// (c) 2004-2005 Angus Turnbull http://www.twinhelix.com

// This is licensed under the CC-GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/

if (typeof IEPNGFIX == 'undefined') {
//--============================================================================

var IEPNGFIX = {
	blank:  siteMatrix + '/images/blank.gif',
	filter: 'DXImageTransform.Microsoft.AlphaImageLoader',

	fixit: function (elem, src, method) {
		if (elem.filters[this.filter]) {
			var filter = elem.filters[this.filter];
			filter.enabled = true;
			filter.src = src;
			filter.sizingMethod = method;
		}
		else {
			elem.style.filter= 'progid:' + this.filter +
				'(src="' + src + '",sizingMethod="' + method + '")';
		}
	},

	fixwidth: function(elem) {
		if (elem.currentStyle.width == 'auto' &&
			elem.currentStyle.height == 'auto') {
			elem.style.width = elem.offsetWidth + 'px';
		}
	},

	fixchild: function(elem, recursive) {
		if (!/MSIE (5\.5|6\.|7\.|8\.)/.test(navigator.userAgent)) return;

		for (var i = 0, n = elem.childNodes.length; i < n; i++) {
			var childNode = elem.childNodes[i];
			if (childNode.style) {
				if (childNode.style.position) {
					childNode.style.position = childNode.style.position;
				}
				else {
					childNode.style.position = 'relative';
				}
			}
			if (recursive && childNode.hasChildNodes()) {
				this.fixchild(childNode, recursive);
			}
		}
	},

	fix: function(elem) {
		if (!/MSIE (5\.5|6\.|7\.|8\.)/.test(navigator.userAgent)) return;

		var bgImg =
			elem.currentStyle.backgroundImage || elem.style.backgroundImage;

		if (elem.tagName == 'IMG') {
			if ((/\.png$/i).test(elem.src)) {
				this.fixwidth(elem);
				this.fixit(elem, elem.src, 'scale');
				elem.src = this.blank;
				elem.runtimeStyle.behavior = 'none';
			}
		}
		else if (bgImg && bgImg != 'none') {
			if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i)) {
				var s = RegExp.$1;
				this.fixwidth(elem);
				elem.style.backgroundImage = 'none';
				this.fixit(elem, s, 'scale'); // crop | image | scale

				if (elem.tagName == 'A' && elem.style) {
					if (!elem.style.cursor) {
						elem.style.cursor = 'pointer';
					}
				}

				this.fixchild(elem);
				elem.runtimeStyle.behavior = 'none';
			}
		}
	},

	hover: function(elem, hvImg) {
		var bgImg = elem.style.backgroundImage;

		if (!bgImg && elem.currentStyle) bgImg = elem.currentStyle.backgroundImage;

		if (elem.tagName == 'IMG' && hvImg) {
			var image = elem.src;
			elem.onmouseover = function() {
				elem.src = hvImg;
				IEPNGFIX.fix(elem);
			};
			elem.onmouseout = function() {
				elem.src = image;
				IEPNGFIX.fix(elem);
			};
		}
		else if (bgImg && bgImg != 'none' && hvImg) {
			elem.onmouseover = function() {
				elem.style.backgroundImage = 'url(' + hvImg + ')';
				IEPNGFIX.fix(elem);
			};
			elem.onmouseout = function() {
				elem.style.backgroundImage = bgImg;
				IEPNGFIX.fix(elem);
			};
		}

		IEPNGFIX.fix(elem);
	}
};

//--============================================================================
} // end if (typeof IEPNGFIX == 'undefined')









/*
============================================================*/
function preload(imgs){
	for(var i = 0; i < imgs.length; i++){
		var imgObj = new Image();
		imgObj.src = imgs[i];
	}
}


/*
============================================================*/

function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

/*  
============================================================*/
try { 
	document.execCommand('BackgroundImageCache', false, true); 
} catch(e) {} 



jq$(document).ready(function(){

	jq$("a").focus(function(){this.blur();})
	jq$("area").focus(function(){this.blur();})



//flatHeights
	jq$('#front_section1 .box p span').flatHeights();
	jq$('.present_items li a').flatHeights();
	jq$('.section2col .flatheight').flatHeights();



	
	
	
//lnv
	var lnvA = jq$('#lnv a');
	lnvA.hover(
		function(){jq$(this).addClass('hv')},
		function(){jq$(this).removeClass('hv')}
	);
	if(lnvID != "") {
		jq$('#lnv' + lnvID).addClass("selected")
			.unbind("mouseover").unbind("mouseout");
	}



//resizable
	if(jq$('textarea.resizable', '#form_section').length) {
		jq$('textarea.resizable:not(.processed)').TextAreaResizer();
	}




//faq
	var qAnc = jq$('h3','#faq');
	var aDiv = jq$('.answer','#faq');
	var faqSlDuration = 700;
	var faqSlEasing = "easeOutQuart";

	//init
	aDiv.hide();
	qAnc.addClass('close');
	jq$('.faq_section').addClass('faq_bg');
	
	jq$('#open_all_btn').click(function(){
			qAnc.removeClass().addClass('open');
			aDiv.slideDown(faqSlDuration, faqSlEasing);
	});
	
	jq$('#close_all_btn').click(function(){
			qAnc.removeClass().addClass('close');
			aDiv.slideUp(faqSlDuration, faqSlEasing);
	});
			
	
	qAnc.click(function(){
		if(jq$(this).next('div').css('display')=='none'){
			jq$(this).removeClass().addClass('open');
			jq$(this).next('div').slideDown(faqSlDuration, faqSlEasing);
		} else {
			jq$(this).removeClass().addClass('close');
			jq$(this).next('div').slideUp(faqSlDuration, faqSlEasing);
		}
	})



////footer font-size
//		if(isMac){
//			jq$('#footer_right').css({'font-size':'11px'});
//		}

//table zebra
	jq$('tr:odd', '.zebra_tbl tbody').addClass('odd');
	jq$('tr:even', '.zebra_tbl tbody').addClass('even');

	jq$('li:odd', '.zebra_ul').addClass('odd');
	jq$('li:even', '.zebra_ul').addClass('even');




//hoverEffect
	jq$('.section_btm_prompt a img').mouseover(
		function(){jq$(this).fadeTo(50, 0.1).fadeTo(400, 1.0)}
	)
	jq$('#btm_prompt a img').mouseover(
		function(){jq$(this).fadeTo(50, 0.1).fadeTo(400, 1.0)}
	)

//flets campaign
	jq$('#main_img_fl_index li img').mouseover(
		function(){jq$(this).fadeTo(50, 0.1).fadeTo(400, 1.0)}
	)


	var dispNum;
	var itemBtn = jq$(".present_items a");
	var totalNum = itemBtn.length;
	var itemBoxOuter = jq$(".item_box_outer");
	var UIbox = jq$('#UIbox');
	var prevBtn = jq$('#itb_prev');
	var nextBtn = jq$('#itb_next');
	
	jq$(itemBoxOuter).css({'display':'none'});
	
	
	jq$(prevBtn).click(function() {
			dispNum -= 1;
			showContent(dispNum);				 
	});
	jq$(nextBtn).click(function() {
			dispNum += 1;
			showContent(dispNum);
	});
	
	
	function showContent(a) {
		jq$('#UIboxContent').html(jq$(jq$(itemBoxOuter)[a]).html());
		if(a < 1) {
			jq$(prevBtn).css({'display':'none'})
		} else { 
			jq$(prevBtn).css({'display':'block'})
		}
		if(a >= totalNum - 1){
			jq$(nextBtn).css({'display':'none'})
		} else { 
			jq$(nextBtn).css({'display':'block'})
		}	
	}
	
	
	jq$(itemBtn).each(function(i){
		jq$(this).click(function() {
			jq$(UIbox).css({'width':'auto','height':'auto'});
			dispNum = jq$(itemBtn).index(this);
			showContent(dispNum);
			jq$.blockUI({ message: jq$(UIbox)});
			jq$('.blockOverlay, #UIbox_close').click(function(){
				jq$(UIbox).css({'width':'1px','height':'1px'});
				jq$.unblockUI();
			})
			return false; 
		}); 
	})













});





/* byon.js
 * Copyright (c) 2009 SACHIO MARUYAMA
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 */


(function(){

	function pageScroll(){

		var scrolledX = scrolledY = null;
		var targetX = targetY = null;
		var scrollX,scrollY;
		var html = document.documentElement;
		var body = document.body;
		var scrollBtns = document.links;
		var url = location.href.replace(location.hash,"");
		
		var easing = 0.25;
		var interval = 30;
		
		
		for(var i=0;i<scrollBtns.length;i++){
			if(scrollBtns[i].getAttribute("href").match("#")){
				var btn = scrollBtns[i];
				btn.onclick = function(){
					var TargetId = (this.getAttribute("href").replace(url,"")).substr(1);
					if (document.getElementById(TargetId)) {
						var Target = document.getElementById(TargetId);
						try {
							var position = Target.getBoundingClientRect();
							targetX = position.left + (body.scrollLeft || html.scrollLeft) - html.clientLeft;
							targetY = position.top + (body.scrollTop || html.scrollTop) - html.clientTop;
						} catch(e) {
							targetX = Target.offsetLeft, targetY = Target.offsetTop;
						}
						scrollX = window.pageXOffset || html.scrollLeft || body.scrollLeft || 0;
						scrollY = window.pageYOffset || html.scrollTop || body.scrollTop || 0;
						scroll();
						return false;
					}
				}
			}
		}
	
		function scroll(){
			var X = window.pageXOffset || html.scrollLeft || body.scrollLeft || 0;
			var Y = window.pageYOffset || html.scrollTop || body.scrollTop || 0;
			scrollX += Math.floor((targetX - X) * easing);
			scrollY += Math.floor((targetY - Y + dif) * easing);
			if((targetY === scrollX && targetY === scrollY) || (X === scrolledX && Y === scrolledY)) {
				scrolledX = scrolledY = null;
			} else {
				window.scrollTo(scrollX, scrollY);
				scrolledX = X, scrolledY = Y;
				setTimeout(function(){scroll()},interval);
			}
		}
	}
    
	function addEvent(eventTarget, eventName, func){
        if(eventTarget.addEventListener){
            eventTarget.addEventListener(eventName, func, false);
        }else if(window.attachEvent){
            eventTarget.attachEvent('on'+eventName, function(){func.apply(eventTarget);});
        }
    }

	addEvent(window, 'load', pageScroll);

}());




/* 
============================================================*/





jq$(document).ready(function() {

//	var dispNum;
//	var itemBtn = jq$(".present_items a");
//	var totalNum = itemBtn.length;
//	var itemBoxOuter = jq$(".item_box_outer");
//	var UIbox = jq$('#UIbox');
//	var prevBtn = jq$('#itb_prev');
//	var nextBtn = jq$('#itb_next');
//	
//	jq$(itemBoxOuter).css({'display':'none'});
//	
//	
//	jq$(prevBtn).click(function() {
//			dispNum -= 1;
//			showContent(dispNum);				 
//	})
//	jq$(nextBtn).click(function() {
//			dispNum += 1;
//			showContent(dispNum);
//	})
//	
//	
//	function showContent(a) {
//		jq$('#UIboxContent').html(jq$(jq$(itemBoxOuter)[a]).html());
//		if(a < 1) {
//			jq$(prevBtn).css({'display':'none'})
//		} else { 
//			jq$(prevBtn).css({'display':'block'})
//		}
//		if(a >= totalNum - 1){
//			jq$(nextBtn).css({'display':'none'})
//		} else { 
//			jq$(nextBtn).css({'display':'block'})
//		}	
//	}
//	
//	
//	jq$(itemBtn).each(function(i){
//		jq$(this).click(function() {
//			jq$(UIbox).css({'width':'auto','height':'auto'});
//			dispNum = jq$(itemBtn).index(this);
//			showContent(dispNum);
//			jq$.blockUI({ message: jq$(UIbox)});
//			jq$('.blockOverlay, #UIbox_close').click(function(){
//				jq$(UIbox).css({'width':'1px','height':'1px'});
//				jq$.unblockUI();
//			})
//			return false; 
//		}); 
//	})
	
	
	

});



