
function getnode(file){
	$.get(
		ac, 
		{action:'nodepage', node:file},
		function(xml){
			 $('#page').html($('content', xml).text());
			 
			
			 
			 document.title = '1002 / ' + $('title', xml).text();
			 __init();
		}
	);	
}

function whyshowcase(){
	text = '1002の主な実績を一挙にご覧いただけます。下のサムネイル（イメージ画像）を <br />クリックして、是非1002の事業コレクション詳細をご覧下さい。<br />また、目的別に事例をご覧になりたい方は、左のメニューから実績を絞り込んで<br />いただくこともできます。';
	$('#page').html('<div class="titleimg"><div class="caption"><img src="/images_titles/whyshowcase.gif" alt="ShowCase" /></div></div><div><div><div class="left">&nbsp;</div><div class="right">'+text+'<div></div></div><div class="c"></div></div><div id="flash"></div></div>');
	$('#flash').flash({ src: '/flash/showcase.swf',  width:'728', height:'499' }, { update: false });
	document.title = '1002 / ShowCase';
}

function press(file){
	$.get(
		ac, 
		{action:'press', ts:file},
		function(xml){
			$('#page').html($('content', xml).text());
			document.title = '1002 / ' + $('title', xml).text();
			 __init();
		}
	);		
}

function hideki(file){
	$.get(
		ac, 
		{action:'hideki', ts:file},
		function(xml){
			$('#page').html($('content', xml).text());
			document.title = '1002 / ' + $('title', xml).text();
			 __init();
		}
	);		
}

function compayinfo(){
	$.get(
		ac, 
		{action:'press-last'},
		function(xml){
			$('#page').html($('content', xml).text());
			document.title = '1002 / Company Info';
			 __init();
		}
	);		
}


var tid = null;

function __init(){ 
	$(".round").nifty("same-height");
	
	window.clearInterval(tid);
	tid = window.setInterval("addReflections()", 10);
	if ($.browser.msie) { 
		$('#page a').each(function(){ 
			$(this).html('<span>' + $(this).html() +'</span>');  
		}
	)};  
	
	$('a.everest').click(function(){ 
			window.scrollTo(0,0);					  
	});
	
	$('#page a').not('.everest').each(function(){
		$(this).css('cursor', 'pointer');
		$(this).click(function(){
			window.location = $(this).attr('href');	
			ajaxtransfer( getAnchor() );
		});
	});
	
	$('h3.notcurrent').css('cursor', 'pointer');
	
	$('h3.notcurrent').click(function(){
		window.location = $(this).next('div').find('a').filter(':first').attr('href');		
		ajaxtransfer( getAnchor() );
	});
}

function _fot(){
		$('.qlright tr').hover(
			function(){
				$('a', this).addClass('c03497d');	
			},
			function(){
				$('a', this).removeClass('c03497d');				
			}
		);
}

function __init2(){
	
		if ($.browser.msie){	
			_fot();
		}
		$('#qlinkz a').click(
			function(){ 
				setTimeout(function(){	
					ajaxtransfer(getAnchor());	
				}
		);});		
}

function qlink(dep){
	$.get(
		ac,
		{
			action:'qlinks', 
			node:dep
		},
		function(xml){
			if ($('content', xml).text()){
			$('#qlinkz').html( $('content', xml).text() );	
		}
		 __init2();
	});	
}

var error = false;

function validatoremail(eml){
	if ($.trim(eml) != ''){
		$.get(
			ac,
			{action:'contact', event:'checkemail', email:eml},
			function(xml){
				if ($('result', xml).text() == 'error'){
					$('#email').removeClass('white')
					$('#email').addClass('red');						
					error = true;
					return false;					
				} else {

				}
			});	
	} else {
		error = true;
		return false;
	
	}
	return true;
}

function mailer(){
	$.get(
			ac,
			{action:'contact', event:'sendmail'},
			function(xml){
				$('#page').html($('content', xml).text());
			}
	);
}

function runmail(){
	data = $('form').serialize();
	data['action'] = 'contact';
	data['event']  = 'savefields';
	$.post(
		ac,
		data,
		function(xml){
			$('#page').html($('content', xml).text());
		}
	);
}

function contactform(){
	$.get(
		ac,
		{action:'contact', event:'start'},
		function(xml){
			$('#page').html($('content', xml).text());
			customRadioButton();
			document.title = '1002 / Contact';
			 __init();
		}
	);
}



function checkbeforsubmit(){
	
	$('.error').css('display', 'none');	
	error = false;

	$('.reqflds span').removeClass('white');	
	$('.reqflds span').addClass('red');
	
	$('input.req').each(
		function(){
			if ($.trim($(this).val()) == ''){
				error = true;
				$('#' + $(this).attr('rel')).removeClass('white').addClass('red');
			}	
		}					
	);	
	
	validatoremail($('input[@name=email]').val());
	
	
	if ( $.trim($('input[@name=email]').val()) == ''){
		$('#email').removeClass('red').addClass('white');
	}
	
	if ( $('#email').attr('class') != 'red'){
		error = true;	
	}
	
	
	
	
	$('input.num').each(function(){
		if (! IsNumeric($(this).val()) ){
			error = true;
			$('#phone').removeClass('white').addClass('red');		
		}	 
	});
		
	
	if (error){
		$('.error').css('display', 'block');	
	} else {
		runmail();	
	}
	
}


function IsNumeric(sText){
  var ValidChars = "0123456789";
  var IsNumber=true;
  var Char;

  for (i = 0; i < sText.length && IsNumber == true; i++){ 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1){
         IsNumber = false;
      }
  }
  return IsNumber;
}