function toggle(targetId , targetId2) {	if (navigator.appVersion.indexOf('MSIE')  != -1){var target = document.all(targetId);var target2= document.all(targetId2);	}else{var target=document.getElementById(targetId);var target2=document.getElementById(targetId2);	}if (target.style.display == "none"){target.style.display="block";target2.style.backgroundImage="url(images/icons/chevron.png)";} else {target.style.display="none";target2.style.backgroundImage="url(images/icons/chevron_expand.png)";}}//-->function menuOver(id){	MM_swapImage(n_menu[id-1],'','images/n_'+ n_menu[id-1]+'1.png',1); 	clearClick();	document.getElementById('sub_menu'+(id-1)).style.display="block" ;	document.getElementById('sub_menu').style.display="block" ; ;	for(i=1;i<s_menu [id-1]+1;i++){	document.getElementById('s_'+n_menu[id-1]+i+'1').style.display="none" ;	document.getElementById('s_'+n_menu[id-1]+i+'0').style.display="block" ;	}	   	}function menuOut(){	for(i=0;i<n_menu .length;i++){	MM_swapImage(n_menu[i],'','images/n_'+ n_menu[i]+'0.png',1); 	}			}	function menuActive(){	for(i=0;i<n_menu .length;i++){	MM_swapImage(n_menu[i],'','images/n_'+ n_menu[i]+'0.png',1); 	}	MM_swapImage(n_menu[mm],'','images/n_'+ n_menu[mm]+'1.png',1);		} function clearClick(){		for(i=1;i<n_menu .length+1;i++){	document.getElementById('menu'+i).style.display="block" ;	document.getElementById(('menu'+i)+'1').style.display="none" ;	document.getElementById(('sub_menu'+(i-1))).style.display="none" ;	}		}function swapClick(id){	clearClick();	     document.getElementById('menu'+id).style.display="none" ;		document.getElementById('menu'+id+1).style.display="block" ;		document.getElementById('sub_menu'+(id-1)).style.display="block" ;		document.getElementById('sub_menu').style.display="block" ;	}	function DisableAllDdl(flag){    var ddl = document.getElementsByTagName('select');    for (i=0;i<ddl.length;i++){     ddl[i].style.display = flag;    }       }		function swapSub(total,id,num){			document.getElementById('hot_news').style.display="none" ;		document.getElementById('m_detail').style.display="block" ;		document.getElementById('b_detail').style.display="block" ;		//showDiv('m_menu') ;		if(navigator.appVersion.indexOf('MSIE ')  != -1  ){	DisableAllDdl('none');	changeOpac(70, 'alpha_b') 	}else{	opacity('m_menu', 0, 100, 300);	opacity('alpha_b', 20 , 70, 2500);				}	clearSub();	for(i=1;i<total+1;i++){				document.getElementById((id+i)+0).style.display="block" ;;		document.getElementById((id+i)+'1').style.display="none" ;			}	document.getElementById(id+num+0).style.display="none" ;	document.getElementById(id+num+1).style.display="block" ;	document.getElementById(id+'_s'+num).style.display="block" ;	if(navigator.appVersion.indexOf('MSIE ')  != -1  ){	//var m_mask =document.getElementById('m_menu').clientHeight ;	//document.getElementById('m_top').style.height = m_mask +"px";		}		  var h_mask =document.getElementById('content').clientHeight ;	   var w_mask =document.getElementById('content').clientWidth ;		document.getElementById('alpha_b').style.height = h_mask +1+"px";				document.getElementById('alpha_b').style.width = w_mask +"px";		document.getElementById('alpha_b').style.display="block" ;	}	function m_top(){		if(navigator.appVersion.indexOf('MSIE ')  != -1  ){		//var m_mask =document.getElementById('m_menu').clientHeight ;	//document.getElementById('m_top').style.height = m_mask +"px";		}		}				//////  function clearSearch(){	document.frm_search.f_search.value = '' ;						}	function checkDiv(id){			if(document.getElementById(id).style.opacity <0){	document.getElementById(id).style.display="none" ;	}						}	function clearSub(){		for(i=0;i<n_menu .length;i++){	var n= Number(s_menu[i])+1;		for(m=1;m< n;m++){	document.getElementById("s_"+n_menu [i]+'_s'+m).style.display="none" ;	MM_swapImgRestore();		}	}		}		function startPage(id,id2 ){			if(active_m == 0){				document.getElementById('hot_news').style.display="block" ;		}else{		document.getElementById('hot_news').style.display="none" ;			}	menuOut();	document.getElementById('m_detail').style.display="none" ;	document.getElementById('b_detail').style.display="none" ;	document.getElementById('alpha_b').style.display="none" ;		clearSub();	if(active_m != 0){    swapClick(id,id);   subClick(id,id2);	}else{	 swapClick(1);	clearClick();		}	 if (navigator.appVersion.indexOf('MSIE 6')  != -1){	DisableAllDdl('inline');		}else{		//opacity('body', 0, 100, 400);				}				}	function subClick(id,id2){	for(i=1;i< Number(s_menu[id -1])+1;i++){		n_sub="s_"+n_menu[id-1];	document.getElementById(n_sub+i+'0').style.display="block" ;	document.getElementById(n_sub+i+'1').style.display="none" ;	}     document.getElementById(n_sub+id2+'0').style.display="none" ;	document.getElementById(n_sub+id2+'1').style.display="block" ;		}  //-->  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];}}}function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}function MM_findObj(n, d) { //v4.01  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}/////**/marqueeee  title///////if (navigator.appVersion.indexOf('MSIE')  == -1){var repeat=0 //enter 0 to not repeat scrolling after 1 run, othersise, enter 1var title=document.titlevar leng=title.lengthvar start=1function titlemove() {  titl=title.substring(start, leng) + title.substring(0, start)  document.title=titl  start++  if (start==leng+1) {    start=0    if (repeat==0)    return  }  setTimeout("titlemove()",100)}//if (document.title)//titlemove();}////******//////	//////  function clearSearch(){	document.frm_search.f_search.value = '' ;						}	function checkDiv(id){			if(document.getElementById(id).style.opacity <0){	document.getElementById(id).style.display = 'none' ;	}						}						///    function gotoUrl(URL){	  window.location = URL;	  	  	  }	  function ieGo(){			if (navigator.appVersion.indexOf('MSIE')  != -1){//	alert('ขออภัยในความไม่สะดวก ทางทีมงานกำลังพัฒนาให้ใช้งานบน Internet Exploror อยู่     ขณะนี้สามารถใช้งานเวบไซต์ได้สมบูรณ์ บน Firfox 3.014 และ  Safari  4.02 ขึ้นไป เท่านั้น');		}		}/***********************************************///Show hide Div/***********************************************/ 	  function hideDiv(targetId){		if (navigator.appVersion.indexOf('MSIE')  != -1){var target = document.all(targetId);	}else{var target=document.getElementById(targetId);	}//myDiv=	document.getElementById(id).style;target.style.display = "none";	}	function showDiv(targetId){	if (navigator.appVersion.indexOf('MSIE')  != -1){var target = document.all(targetId);	}else{var target=document.getElementById(targetId);	}target.style.display =  "block";	}	  	   /***********************************************///goto Top/***********************************************/function gotoTop() {  if (document.body.scrollTop!=0 || document.documentElement.scrollTop!=0){   window.scrollBy(0,-3000);    t=setTimeout('gotoTop()',50);  }  else clearTimeout(t);}function openPopOverlay(targetId){	//showDiv(targetId);	//hideDiv('hot_news');	var h_mask =document.getElementById('body').clientHeight ;	var w_mask =document.getElementById('content').clientWidth ;		//document.getElementById('alpha_b').style.height = h_mask +1+"px";				//document.getElementById('alpha_b').style.width = w_mask +"px";		document.getElementById('alpha_pop').style.height = (h_mask+30)+"px";				document.getElementById('alpha_pop').style.width = (screen.width -15)+"px";		showDiv('alpha_pop');	changeOpac(70, 'alpha_pop') ;	}function closePopOverlay(targetId){	//showDiv('hot_news');	//hideDiv(targetId);	hideDiv('alpha_pop');		}/***********************************************////Fade In -Out Div/***********************************************/function opacity(id, opacStart, opacEnd, millisec) {	//speed for each frame	var speed = Math.round(millisec / 100);	var timer = 0;	//determine the direction for the blending, if start and end are the same nothing happens	if(opacStart > opacEnd) {		for(i = opacStart; i >= opacEnd; i--) {			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));			timer++;		}	} else if(opacStart < opacEnd) {		for(i = opacStart; i <= opacEnd; i++)			{			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));			timer++;		}	}}//change the opacity for different browsersfunction changeOpac(opacity, id) {	var object = document.getElementById(id).style; 	object.opacity = (opacity / 100);	object.MozOpacity = (opacity / 100);	object.KhtmlOpacity = (opacity / 100);	object.filter = "alpha(opacity=" + opacity + ")";}function shiftOpacity(id, millisec) {	//if an element is invisible, make it visible, else make it ivisible	if(document.getElementById(id).style.opacity == 0) {		opacity(id, 0, 100, millisec);	} else {		opacity(id, 100, 0, millisec);	}}function blendimage(divid, imageid, imagefile, millisec) {	var speed = Math.round(millisec / 100);	var timer = 0;		//set the current image as background	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";		//make image transparent	changeOpac(0, imageid);		//make new image	document.getElementById(imageid).src = imagefile;	//fade in image	for(i = 0; i <= 100; i++) {		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));		timer++;	}}function currentOpac(id, opacEnd, millisec) {	//standard opacity is 100	var currentOpac = 100;		//if the element has an opacity set, get it	if(document.getElementById(id).style.opacity < 100) {		currentOpac = document.getElementById(id).style.opacity * 100;	}	//call for the function that changes the opacity	opacity(id, currentOpac, opacEnd, millisec)}  /************************************************ fade in out Banner/***********************************************/ var fadebgcolor="white"////NO need to edit beyond here///////////// var fadearray=new Array() //array to cache fadeshow instancesvar fadeclear=new Array() //array to cache corresponding clearinterval pointers var dom=(document.getElementById) //modern dom browsersvar iebrowser=document.all function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){this.pausecheck=pausethis.mouseovercheck=0this.delay=delaythis.degree=10 //initial opacity degree (10%)this.curimageindex=0this.nextimageindex=1fadearray[fadearray.length]=thisthis.slideshowid=fadearray.length-1this.canvasbase="canvas"+this.slideshowidthis.curcanvas=this.canvasbase+"_0"if (typeof displayorder!="undefined")theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)this.theimages=theimagesthis.imageborder=parseInt(borderwidth)this.postimages=new Array() //preload imagesfor (p=0;p<theimages.length;p++){this.postimages[p]=new Image()this.postimages[p].src=theimages[p][0]} var fadewidth=fadewidth+this.imageborder*2var fadeheight=fadeheight+this.imageborder*2 if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')elsedocument.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>') if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefoxthis.startit()else{this.curimageindex++setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)}}function fadepic(obj){if (obj.degree<100){obj.degree+=5if (obj.tempobj.filters&&obj.tempobj.filters[0]){if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+obj.tempobj.filters[0].opacity=obj.degreeelse //else if IE5.5-obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"}else if (obj.tempobj.style.MozOpacity)obj.tempobj.style.MozOpacity=obj.degree/101else if (obj.tempobj.style.KhtmlOpacity)obj.tempobj.style.KhtmlOpacity=obj.degree/100else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)obj.tempobj.style.opacity=obj.degree/101}else{clearInterval(fadeclear[obj.slideshowid])obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)obj.populateslide(obj.tempobj, obj.nextimageindex)obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)}} fadeshow.prototype.populateslide=function(picobj, picindex){var slideHTML=""if (this.theimages[picindex][1]!="") //if associated link exists for imageslideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'"  >'slideHTML+='<img src="'+this.postimages[picindex].src+'"    border="'+this.imageborder+'" title="'+this.theimages[picindex][3]+'" width="'+this.theimages[picindex][4]+'" height="'+this.theimages[picindex][5]+'" >'if (this.theimages[picindex][1]!="") //if associated link exists for imageslideHTML+='</a>'picobj.innerHTML=slideHTML}  fadeshow.prototype.rotateimage=function(){if (this.pausecheck==1) //if pause onMouseover enabled, cache objectvar cacheobj=thisif (this.mouseovercheck==1)setTimeout(function(){cacheobj.rotateimage()}, 100)else if (iebrowser&&dom||dom){this.resetit()var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)crossobj.style.zIndex++if(crossobj.style.zIndex>10){	crossobj.style.zIndex = 0;	}fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"}else{var ns4imgobj=document.images['defaultslide'+this.slideshowid]ns4imgobj.src=this.postimages[this.curimageindex].src}this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0} fadeshow.prototype.resetit=function(){this.degree=10var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)if (crossobj.filters&&crossobj.filters[0]){if (typeof crossobj.filters[0].opacity=="number") //if IE6+crossobj.filters(0).opacity=this.degreeelse //else if IE5.5-crossobj.style.filter="alpha(opacity="+this.degree+")"}else if (crossobj.style.MozOpacity)crossobj.style.MozOpacity=this.degree/101else if (crossobj.style.KhtmlOpacity)crossobj.style.KhtmlOpacity=this.degree/100else if (crossobj.style.opacity&&!crossobj.filters)crossobj.style.opacity=this.degree/101}  fadeshow.prototype.startit=function(){var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)this.populateslide(crossobj, this.curimageindex)if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVERvar cacheobj=thisvar crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}}this.rotateimage()}//end fade Banner  /* Text and/or Image Crawler Script Â©2009 John Davenport Scheuer   as first seen in http://www.dynamicdrive.com/forums/   username: jscheuer1 - This Notice Must Remain for Legal Use   *////////////////// DO NOT EDIT /////////////////function marqueeInit(config){ if(!document.createElement) return; marqueeInit.ar.push(config); marqueeInit.run(config.uniqueid);}(function(){ if(!document.createElement) return; marqueeInit.ar = []; document.write('<style type="text/css">.marquee{white-space:nowrap;overflow:hidden;visibility:hidden;}' + '#marq_kill_marg_bord{border:none!important;margin:0!important;}<\/style>'); var c = 0, tTRE = [new RegExp('^\\s*$'), new RegExp('^\\s*'), new RegExp('\\s*$')], req1 = {'position': 'relative', 'overflow': 'hidden'}, defaultconfig = {  style: { //default style object for marquee containers without configured style	'margin': '0 auto'  },  direction: 'left',  inc: 2, //default speed - pixel increment for each iteration of a marquee's movement  mouse: 'pause' //default mouseover behavior ('pause' 'cursor driven' or false) }, dash, ie = false, oldie = 0, ie5 = false, iever = 0;  /*@cc_on @*/ /*@if(@_jscript_version >= 5) ie = true; try{document.documentMode = 2000}catch(e){}; iever = Math.min(document.documentMode, navigator.appVersion.replace(/^.*MSIE (\d+\.\d+).*$/, '$1')); if(iever < 6)  oldie = 1; if(iever < 5.5){  Array.prototype.push = function(el){this[this.length] = el;};  ie5 = true;  dash = new RegExp('(-(.))');  String.prototype.encamel = function(s, m){   s = this;   while((m = s.match(dash)))    s = s.replace(m[1], m[2].toUpperCase());   return s;  }; } @end @*/ if(!ie5){  dash = new RegExp('-(.)', 'g');  function toHump(a, b){return b.toUpperCase();};  String.prototype.encamel = function(){return this.replace(dash, toHump);}; } if(ie && iever < 8){  marqueeInit.table = [];  window.attachEvent('onload', function(){   marqueeInit.OK = true;   for(var i = 0; i < marqueeInit.table.length; ++i)   marqueeInit.run(marqueeInit.table[i]);  }); }  function intable(el){  while((el = el.parentNode))   if(el.tagName && el.tagName.toLowerCase() === 'table')    return true;   return false; }; marqueeInit.run = function(id){   if(ie && !marqueeInit.OK && iever < 8 && intable(document.getElementById(id))){    marqueeInit.table.push(id);    return;   }   if(!document.getElementById(id))    setTimeout(function(){marqueeInit.run(id);}, 300);   else    new Marq(c++, document.getElementById(id)); } function trimTags(tag){  var r = [], i = 0, e;  while((e = tag.firstChild) && e.nodeType == 3 && tTRE[0].test(e.nodeValue))   tag.removeChild(e);  while((e = tag.lastChild) && e.nodeType == 3 && tTRE[0].test(e.nodeValue))   tag.removeChild(e);  if((e = tag.firstChild) && e.nodeType == 3)   e.nodeValue = e.nodeValue.replace(tTRE[1], '');  if((e = tag.lastChild) && e.nodeType == 3)   e.nodeValue = e.nodeValue.replace(tTRE[2], '');  while((e = tag.firstChild))   r[i++] = tag.removeChild(e);  return r; } function Marq(c, tag){  var p, u, s, a, ims, ic, i, marqContent, cObj = this;  this.mq = marqueeInit.ar[c];  for (p in defaultconfig)   if((this.mq.hasOwnProperty && !this.mq.hasOwnProperty(p)) || (!this.mq.hasOwnProperty && !this.mq[p]))    this.mq[p] = defaultconfig[p];  this.mq.style.width = !this.mq.style.width || isNaN(parseInt(this.mq.style.width))? '100%' : this.mq.style.width;  if(!tag.getElementsByTagName('img')[0])   this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? tag.offsetHeight + 3 + 'px' : this.mq.style.height;  else   this.mq.style.height = !this.mq.style.height || isNaN(parseInt(this.mq.style.height))? 'auto' : this.mq.style.height;  u = this.mq.style.width.split(/\d/);  this.cw = this.mq.style.width? [parseInt(this.mq.style.width), u[u.length - 1]] : ['a'];  marqContent = trimTags(tag);  tag.className = tag.id = '';  tag.removeAttribute('class', 0);  tag.removeAttribute('id', 0);  if(ie)   tag.removeAttribute('className', 0);  tag.appendChild(tag.cloneNode(false));  tag.className = ['marquee', c].join('');  tag.style.overflow = 'hidden';  this.c = tag.firstChild;  this.c.appendChild(this.c.cloneNode(false));  this.c.style.visibility = 'hidden';  a = [[req1, this.c.style], [this.mq.style, this.c.style]];  for (i = a.length - 1; i > -1; --i)   for (p in a[i][0])    if((a[i][0].hasOwnProperty && a[i][0].hasOwnProperty(p)) || (!a[i][0].hasOwnProperty))     a[i][1][p.encamel()] = a[i][0][p];  this.m = this.c.firstChild;  if(this.mq.mouse == 'pause'){   this.c.onmouseover = function(){cObj.mq.stopped = true;};   this.c.onmouseout = function(){cObj.mq.stopped = false;};  }  this.m.style.position = 'absolute';  this.m.style.left = '-10000000px';  this.m.style.whiteSpace = 'nowrap';  if(ie5) this.c.firstChild.appendChild((this.m = document.createElement('nobr')));  if(!this.mq.noAddedSpace)   this.m.appendChild(document.createTextNode('\xa0'));  for(i = 0; marqContent[i]; ++i)   this.m.appendChild(marqContent[i]);  if(ie5) this.m = this.c.firstChild;  ims = this.m.getElementsByTagName('img');  if(ims.length){   for(ic = 0, i = 0; i < ims.length; ++i){    ims[i].style.display = 'inline';    ims[i].style.verticalAlign = ims[i].style.verticalAlign || 'top';    if(typeof ims[i].complete == 'boolean' && ims[i].complete && !window.opera)     ic++;    else {     ims[i].onload = function(){       if(++ic == ims.length)        cObj.setup();      };    }     if(ic == ims.length)      this.setup();   }  }   else this.setup() }  Marq.prototype.setup = function(){  if(this.mq.setup) return;  this.mq.setup = this;  var s, cObj = this;  if(this.c.style.height === 'auto')   this.c.style.height = this.m.offsetHeight + 4 + 'px';  this.c.appendChild(this.m.cloneNode(true));  this.m = [this.m, this.m.nextSibling];  if(this.mq.mouse == 'cursor driven'){   this.r = this.mq.neutral || 16;   this.sinc = this.mq.inc;   this.c.onmousemove = function(e){cObj.mq.stopped = false; cObj.directspeed(e)};   if(this.mq.moveatleast){    this.mq.inc = this.mq.moveatleast;    if(this.mq.savedirection){     if(this.mq.savedirection == 'reverse'){      this.c.onmouseout = function(e){       if(cObj.contains(e)) return;       cObj.mq.inc = cObj.mq.moveatleast;       cObj.mq.direction = cObj.mq.direction == 'right'? 'left' : 'right';};          } else {      this.mq.savedirection = this.mq.direction;      this.c.onmouseout = function(e){       if(cObj.contains(e)) return;       cObj.mq.inc = cObj.mq.moveatleast;       cObj.mq.direction = cObj.mq.savedirection;};         }    } else     this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.mq.inc = cObj.mq.moveatleast;};   }   else    this.c.onmouseout = function(e){if(!cObj.contains(e)) cObj.slowdeath();};  }  this.w = this.m[0].offsetWidth;  this.m[0].style.left = 0;  this.c.id = 'marq_kill_marg_bord';  this.m[0].style.top = this.m[1].style.top = Math.floor((this.c.offsetHeight - this.m[0].offsetHeight) / 2 - oldie) + 'px';  this.c.id = '';  this.c.removeAttribute('id', 0);  this.m[1].style.left = this.w + 'px';  s = this.mq.moveatleast? Math.max(this.mq.moveatleast, this.sinc) : (this.sinc || this.mq.inc);  while(this.c.offsetWidth > this.w - s)   this.c.style.width = isNaN(this.cw[0])? this.w - s + 'px' : --this.cw[0] + this.cw[1];  this.c.style.visibility = 'visible';  this.runit();  }   Marq.prototype.slowdeath = function(){  var cObj = this;  if(this.mq.inc){   this.mq.inc -= 1;   this.timer = setTimeout(function(){cObj.slowdeath();}, 100);  } } Marq.prototype.runit = function(){  var cObj = this, d = this.mq.direction == 'right'? 1 : -1;  if(this.mq.stopped || this.mq.stopMarquee){   setTimeout(function(){cObj.runit();}, 300);   return;  }  if(this.mq.mouse != 'cursor driven')   this.mq.inc = Math.max(1, this.mq.inc);  if(d * parseInt(this.m[0].style.left) >= this.w)   this.m[0].style.left = parseInt(this.m[1].style.left) - d * this.w + 'px';  if(d * parseInt(this.m[1].style.left) >= this.w)   this.m[1].style.left = parseInt(this.m[0].style.left) - d * this.w + 'px';  this.m[0].style.left = parseInt(this.m[0].style.left) + d * this.mq.inc + 'px';  this.m[1].style.left = parseInt(this.m[1].style.left) + d * this.mq.inc + 'px';  setTimeout(function(){cObj.runit();}, 30 + (this.mq.addDelay || 0)); } Marq.prototype.directspeed = function(e){  e = e || window.event;  if(this.timer) clearTimeout(this.timer);  var c = this.c, w = c.offsetWidth, l = c.offsetLeft, mp = (typeof e.pageX == 'number'?   e.pageX : e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft) - l,  lb = (w - this.r) / 2, rb = (w + this.r) / 2;  while((c = c.offsetParent)) mp -= c.offsetLeft;  this.mq.direction = mp > rb? 'left' : 'right';  this.mq.inc = Math.round((mp > rb? (mp - rb) : mp < lb? (lb - mp) : 0) / lb * this.sinc); } Marq.prototype.contains = function(e){  if(e && e.relatedTarget){var c = e.relatedTarget; if(c == this.c) return true;   while ((c = c.parentNode)) if(c == this.c) return true;}  return false; } function resize(){  for(var s, m, i = 0; i < marqueeInit.ar.length; ++i){   if(marqueeInit.ar[i] && marqueeInit.ar[i].setup){    m = marqueeInit.ar[i].setup;    s = m.mq.moveatleast? Math.max(m.mq.moveatleast, m.sinc) : (m.sinc || m.mq.inc);    m.c.style.width = m.mq.style.width;    m.cw[0] = m.cw.length > 1? parseInt(m.mq.style.width) : 'a';    while(m.c.offsetWidth > m.w - s)     m.c.style.width = isNaN(m.cw[0])? m.w - s + 'px' : --m.cw[0] + m.cw[1];   }  } } if (window.addEventListener)  window.addEventListener('resize', resize, false); else if (window.attachEvent)  window.attachEvent('onresize', resize);})();//////end marqee////************************************************ Ajax Page Fetcher- by JavaScript Kit (www.javascriptkit.com)***********************************************/var ajaxpagefetcher={loadingmessage: "<div style='margin :20px 0px 0px 20px;'><img src='images/loading.gif' align='absmiddle' hspace='10'/>กรุณารอสักครู่....</div>",exfilesadded: "",connect:function(containerid, pageurl, bustcache, jsfiles, cssfiles){	document.getElementById(containerid).style.display="block" ;	var page_request = false	var bustcacheparameter=""	if (window.XMLHttpRequest) // if Mozilla, IE7, Safari etc		page_request = new XMLHttpRequest()	else if (window.ActiveXObject){ // if IE6 or below		try {		page_request = new ActiveXObject("Msxml2.XMLHTTP")		} 		catch (e){			try{			page_request = new ActiveXObject("Microsoft.XMLHTTP")			}			catch (e){}		}		}	else		return false	var ajaxfriendlyurl=pageurl.replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/") 	page_request.onreadystatechange=function(){ajaxpagefetcher.loadpage(page_request, containerid, pageurl, jsfiles, cssfiles)}	if (bustcache) //if bust caching of external page		bustcacheparameter=(ajaxfriendlyurl.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()	document.getElementById(containerid).innerHTML=ajaxpagefetcher.loadingmessage //Display "fetching page message"	page_request.open('GET', ajaxfriendlyurl+bustcacheparameter, true)	page_request.send(null)},loadpage:function(page_request, containerid, pageurl, jsfiles, cssfiles){	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){		document.getElementById(containerid).innerHTML=page_request.responseText		for (var i=0; i<jsfiles.length; i++)			this.loadjscssfile(jsfiles[i], "js")		for (var i=0; i<cssfiles.length; i++)			this.loadjscssfile(cssfiles[i], "css")		this.pageloadaction(pageurl) //invoke custom "onpageload" event	}},createjscssfile:function(filename, filetype){	if (filetype=="js"){ //if filename is a external JavaScript file		var fileref=document.createElement('script')		fileref.setAttribute("type","text/javascript")		fileref.setAttribute("src", filename)	}	else if (filetype=="css"){ //if filename is an external CSS file		var fileref=document.createElement("link")		fileref.setAttribute("rel", "stylesheet")		fileref.setAttribute("type", "text/css")		fileref.setAttribute("href", filename)	}	return fileref},loadjscssfile:function(filename, filetype){ //load or replace (if already exists) external .js and .css files	if (this.exfilesadded.indexOf("["+filename+"]")==-1){ //if desired file to load hasnt already been loaded		var newelement=this.createjscssfile(filename, filetype)		document.getElementsByTagName("head")[0].appendChild(newelement)		this.exfilesadded+="["+filename+"]" //remember this file as being added	}	else{ //if file has been loaded already (replace/ refresh it) 	var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist using 	var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for 	var allsuspects=document.getElementsByTagName(targetelement) 	for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove  	if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1){   	var newelement=this.createjscssfile(filename, filetype)   	allsuspects[i].parentNode.replaceChild(newelement, allsuspects[i])  	}		} }},pageloadaction:function(pageurl){	this.onpageload(pageurl) //call customize onpageload() function when an ajax page is fetched/ loaded},onpageload:function(pageurl){ //do nothing by default},load:function(containerid, pageurl, bustcache, jsfiles, cssfiles){	var jsfiles=(typeof jsfiles=="undefined" || jsfiles=="")? [] : jsfiles	var cssfiles=(typeof cssfiles=="undefined" || cssfiles=="")? [] : cssfiles	this.connect(containerid, pageurl, bustcache, jsfiles, cssfiles)m_top();}} //End object//Sample usage://1) ajaxpagefetcher.load("mydiv", "content.htm", true)//2) ajaxpagefetcher.load("mydiv2", "content.htm", true, ["external.js"])//3) ajaxpagefetcher.load("mydiv2", "content.htm", true, ["external.js"], ["external.css"])//4) ajaxpagefetcher.load("mydiv2", "content.htm", true, ["external.js", "external2.js"])//5) ajaxpagefetcher.load("mydiv2", "content.htm", true, "", ["external.css", "external2.css"])
