//initLibrary

function initLibrary(){
	if(navigator.appVersion.indexOf("Mac") > -1 && navigator.appName.charAt(0) == "M"){
		//MacIE
  	}else{
		//Others
		document.write('<script src="common/js/prototype.js" type="text/javascript"></script>');
		document.write('<script src="common/js/rico.js" type="text/javascript"></script>');
	}
}



//loadRSS
function loadRSS () {
    var url = "/event/feed.rss";
    var http = new JKL.ParseXML( url );
    var func = function ( data ) {
        var items = data["rdf:RDF"].item;
           for( var i=0; i<items.length; i++ ) {
               var dd = new Date();
               dd.setW3CDTF( items[i]["dc:date"] );
               var date = dd.getFullYear() + "/" + (dd.getMonth()+1) + "/" +
                          dd.getDate();
               items[i]["dc:date"] = date;
           }
        var items = data["rdf:RDF"].item;
            if ( items.length > 3 ) items.length = 3;
        var hina = new JKL.Hina( "rssbox" );
        var dest = hina.expand( data, "rssbox" );
        dest.style.display = "";
    };
    http.async( func );
    http.parse();
}

//initAccordion
function initAccordion (){
	if(navigator.appVersion.indexOf("Mac") > -1 && navigator.appName.charAt(0) == "M"){
		//MacIE
  	}else{
		new Rico.Accordion( $('visitNav'), { panelHeight:95, borderColor:'#fff', onLoadShowTab:0 } );
	}
}

//rollOver.js
function initRollovers() {
	if (!document.getElementById) return

	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'btn') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);	//.jpg	_current.jpg

			aImages[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	

			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'btn2') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);	//.jpg	_current.jpg

			aImages[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	

			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}

			aImages[i].onmouseup = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}	
		}
	}
}

//window.onload = initRollovers;

//swapImage
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//search
function setHeaderForm (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://www.saitama-u.ac.jp/search/index.html" id="cse-search-box">');
	document.write('<input type="hidden" name="cx" value="011514390577796484903:umesrnqhvea" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<input name="q" type="text"/>&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');
}

function sendHeaderForm(){
	var formData;
	for(var i=0; i<document.search_form.radiobutton.length; i++){
		if(document.search_form.radiobutton[i].checked == true){
			formData = document.search_form.radiobutton[i].value;
		}
	}
	
	if(formData == 'people'){
		document.search_form.target = '_blank';
	}else{
		document.search_form.target = '';
	}
	
	document.search_form.submit();
	
	return false;
}


//search
function setLeftForm_liberal (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://wwwnew.kyy.saitama-u.ac.jp/search/index.html" id="searchbox_011514390577796484903:1widfafpe3c">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:1widfafpe3c" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">教養学部サイト内検索</span>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');
   
 	
	
}


//search
function setLeftForm_edu (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://www.edu.saitama-u.ac.jp/search/index.html" id="searchbox_011514390577796484903:e-izmm2zzh4">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:e-izmm2zzh4" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">教育学部サイト内検索</span>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');
}

//search
function setLeftForm_economics (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://www.eco.saitama-u.ac.jp/search/index.html" id="searchbox_011514390577796484903:vttvgvrrpcc">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:vttvgvrrpcc" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">経済学部サイト内検索</span>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');

}

//search
function setLeftForm_science (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://www.sci.saitama-u.ac.jp/search/index.html" id="searchbox_011514390577796484903:wpcplfvy4ue">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:wpcplfvy4ue" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">理学部サイト内検索</span>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');

}


//search
function setLeftForm_tech (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://engineering.saitama-u.ac.jp/search/index.html" id="searchbox_011514390577796484903:sgbtje6y4im">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:sgbtje6y4im" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">工学部サイト内検索</span>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');

}



//search
function setLeftForm_grad_culture (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://wwwnew.kyy.saitama-u.ac.jp/gs/search/index.html" id="searchbox_011514390577796484903:_mfgx3oxu0c">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:_mfgx3oxu0c" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">大学院文化科学研究科<br>サイト内検索</span><br>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');

}

//search
function setLeftForm_grad_education (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://www.edu.saitama-u.ac.jp/grad/search/index.html" id="searchbox_011514390577796484903:ozaoc82ilmc">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:ozaoc82ilmc" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">大学院教育学研究科<br>サイト内検索</span><br>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');

}

//search
function setLeftForm_grad_economics (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://www.eco.saitama-u.ac.jp/grad/search/index.html" id="searchbox_011514390577796484903:ggadhk-k9bs">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:ggadhk-k9bs" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">大学院経済科学研究科<br>サイト内検索</span><br>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');

}

//search
function setLeftForm_grad_science (){
	document.write('<div id="headerSearch">');
	document.write('<form action="http://www.saitama-u.ac.jp/rikogaku/search/index.html" id="searchbox_011514390577796484903:vyojxf_ssom">');
 	document.write('<input type="hidden" name="cx" value="011514390577796484903:vyojxf_ssom" />');
    document.write('<input type="hidden" name="cof" value="FORID:11" />');
	document.write('<span class="mtx">大学院理工学研究科<br>サイト内検索</span><br>');
	document.write('<input name="q" type="text" size="17" />&nbsp;');
	document.write('<input id="submitButtom" type="submit" name="sa" value="検索" />');
	document.write('<input type="hidden" name="ie" value="Shift-JIS" />');
	document.write('<input type="hidden" name="oe" value="Shift-JIS" />');
	document.write('<input type="hidden" name="cof" value="FORID:11" />');
   	document.write('</form>');
	document.write('</div>');

}

