1function getRoot(){ 2 var path = this.window.location.href; 3 path = path.replace('http://', ''); 4 path = path.replace(document.location.host, ''); 5 path = path.split('public'); 6 return path[0]+"public/"; 7} 8 9function slider(obj,type){ 10 $(obj).cycle({ 11 fx: type // choose your transition type, ex: fade, scrollUp, shuffle, etc... 12 }); 13} 14function getXMLHTTP() { 15 var xmlhttp=false; 16 try{ 17 xmlhttp=new XMLHttpRequest(); 18 } 19 catch(e) { 20 try{ 21 xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); 22 } 23 catch(e){ 24 try{ 25 req = new ActiveXObject("Msxml2.XMLHTTP"); 26 } 27 catch(e1){ 28 xmlhttp=false; 29 } 30 } 31} 32 33return xmlhttp; 34}// end function getXMLHTTP() 35 36function ajax(dtarget,file,pmeters){ 37 38 var req = getXMLHTTP(); 39 if(req){ 40 41 req.onreadystatechange = function() { 42 43 if(req.readyState == 3){ 44 } 45 46 if (req.readyState == 4){ 47 var result=req.responseText; 48 document.getElementById(dtarget).innerHTML=result; 49 50 }// end if (req.readyState == 4) 51 52 } 53 54 var rstr=Math.random(); 55 var strURL=file+"?rstr="+rstr; 56 req.open('POST',strURL,true); 57 req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 58 req.send(pmeters); 59 } 60}//end function display() 61 62 63/*var winw = 240; 64var winh = 65;*/ 65var winw = 220; 66var winh = 19; 67var ie=(document.all); 68var ns=(document.layers); 69var ns6=(document.getElementById && !ie); 70var calculate=ns? "" : "px" 71 72function loadElement(){ 73 if(!ns && !ie && !ns6) return; 74 if(ie) popup=eval('document.all.ajaxBusy.style'); 75 else if(ns) popup=eval('document.layers["ajaxBusy"]'); 76 else if(ns6) popup=eval('document.getElementById("ajaxBusy").style'); 77 if (ie||ns6) popup.visibility="visible"; 78 else popup.visibility ="show"; 79 displayElement(); 80} 81 82function displayElement(){ 83 84 var agent=navigator.userAgent.toLowerCase(); 85 if (ie){ 86 documentWidth = (centerElement().offsetWidth)/2+centerElement().scrollLeft-(winw/2); 87 documentHeight = (centerElement().offsetHeight)/2+centerElement().scrollTop-(winh/2); 88 } 89 else if (ns){ 90 documentWidth=window.innerWidth/2+window.pageXOffset-(winw/2); 91 documentHeight=window.innerHeight/2+window.pageYOffset-(winh/2); 92 } 93 else if (ns6){ 94 documentWidth=self.innerWidth/2+window.pageXOffset-(winw/2); 95 documentHeight=self.innerHeight/2+window.pageYOffset-(winh/2); 96 } 97 popup.left = documentWidth+calculate; 98 popup.top = documentHeight+calculate; 99 $('#ajaxBusy').show(); 100 101} 102 103function centerElement(){ 104 return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body 105} 106 107function MyAjax(MyUrl,MyData,MyTarget,Func){ 108 if(MyTarget!=""){ 109 110 $('#ajaxBusy').remove(); 111 $("body").append("<div id='ajaxBusy'><div style='200px;'><img src='/public/jquery/css/images/loader.gif' width='220' height='19' /></div><div style='width:200px;text-align:center;font-weight:x-small;'>Process...</div></div>"); 112 $('#ajaxBusy').css({ 113 width:"220px", 114 zIndex: 3999, 115 display:"none", 116 margin:"0px", 117 paddingLeft:"10px", 118 paddingRight:"10px", 119 paddingTop:"15px", 120 paddingBottom:"15px", 121 position:"absolute", 122 background:"#eeeeee", 123 border:"1px solid #666666", 124 top:"50%", 125 left:"50%" 126 }); 127 loadElement(); 128 129 } 130 131 132 $.ajax({ 133 type: "POST", 134 url: MyUrl+"/layout/ajax", 135 data:MyData, 136 success: function(data){ 137 138 if(MyTarget==""){ 139 eval(Func); 140 }else{ 141 142 var newTarget=MyTarget; 143 if(MyTarget=="#ajax"){ 144 145 if(document.getElementById('displaySubcontent')!=null){ 146 147 newTarget="#displaySubcontent"; 148 } 149 } 150 151 $(newTarget).html(data).fadeIn("slow"); 152 $("#ajaxBusy").remove(); 153 154 if(Func!=""){ 155 eval(Func); 156 } 157 } 158 159 160 } 161 }); 162 $(".formError").remove(); 163} 164 165function MyAjax2(MyUrl,MyData,MyTarget,Func){ 166 167 $.ajax({ 168 type: "POST", 169 url: MyUrl+"/layout/ajax", 170 data:MyData, 171 success: function(data){ 172 173 if(MyTarget==""){ 174 eval(Func); 175 }else{ 176 177 var newTarget=MyTarget; 178 if(MyTarget=="#ajax"){ 179 180 if(document.getElementById('displaySubcontent')!=null){ 181 182 newTarget="#displaySubcontent"; 183 } 184 } 185 $(newTarget).html(data).fadeIn("slow"); 186 $('#ajaxBusy').remove(); 187 188 if(Func!=""){ 189 eval(Func); 190 } 191 } 192 193 194 } 195 }); 196 197 $(".formError").remove(); 198} 199 200 201function myConfirm(text,func){ 202 if(confirm(text)){ 203 eval(func); 204 }else{ 205 return false;
206 } 207} 208 209function getVal(MyUrl){ 210$.ajaxSetup({ 211 cache: true 212}); 213 var html = $.ajax({ 214 url: MyUrl, 215 async: false 216 }).responseText; 217 218 return html; 219} 220 221function getRadio(obj_name){ 222 // -1 à¸à¸µà¹à¸à¸±à¹à¸à¹à¸§à¹à¹à¸à¹à¸à¸à¹à¸² default à¸à¸£à¸à¸µà¹à¸¡à¹à¹à¸à¹à¹à¸¥à¸·à¸à¸à¸à¸°à¹à¸£à¹à¸¥à¸¢ 223 var radios =-1; 224 225 // หลัà¸à¸à¸²à¸£à¸à¸·à¸à¹à¸à¸² Element à¸à¸±à¸§à¸à¸µà¹à¸¡à¸²à¸§à¸à¸à¸²à¸¡à¸à¸³à¸à¸§à¸à¸à¸±à¹à¸à¸«à¸¡à¸à¸à¸µà¹à¸¡à¸µà¹à¸à¸¢à¸à¸à¸°à¸à¸µà¹à¸§à¸à¹à¸«à¹à¸à¸¹à¸§à¹à¸²à¸à¸±à¸§à¹à¸«à¸à¸à¸¹à¸ checked à¸à¸¢à¸¹à¹à¸à¹à¹à¸à¸²à¸à¹à¸²à¸à¸±à¸§à¸à¸±à¹à¸à¸¡à¸² 226 // length à¸à¸¥à¹à¸²à¸¢à¹à¸§à¹à¸²à¸à¸°à¹à¸à¹à¸à¸¹à¸à¸à¸²à¸ input à¸à¸µà¹à¹à¸à¹à¸ array à¸à¸±à¸§à¸à¸±à¹à¸à¹ à¸à¸¶à¹à¸à¹à¸à¸à¸µà¹à¸à¸µà¹à¸à¹à¸² obj_name = gender à¸à¹à¸à¸°à¸¡à¸µà¸à¹à¸²à¹à¸à¹à¸ 2 227 for(var j=0;j<document.getElementsByName(obj_name).length;j++){ 228 229 if (document.getElementsByName(obj_name)[j].checked){ 230 radios=document.getElementsByName(obj_name)[j].value; 231 } 232 } 233 return radios; 234 235}// end functin getRadio() 236 237function getCheckbox(obj_name){ 238 var checkboxs = new Array(); 239 var count=0; 240 for(var j=0;j<document.getElementsByName(obj_name).length;j++){ 241 242 if (document.getElementsByName(obj_name)[j].checked){ 243 if(document.getElementsByName(obj_name)[j].value!=""){ 244 // à¹à¸«à¸¡à¸·à¸à¸à¹à¸à¹à¸à¸à¸²à¸£à¹à¸à¸´à¹à¸¡à¸à¹à¸à¸¡à¸¹à¸¥ ลà¸à¹à¸à¹à¸à¸à¹à¸²à¸¢à¸ªà¸¸à¸à¸à¸à¸ array? 245 checkboxs.push(document.getElementsByName(obj_name)[j].value); 246 count++; 247 } 248 } 249 } 250 251 if(count==0){ 252 // à¹à¸¡à¸·à¹à¸ checkbox à¹à¸¡à¹à¸¡à¸µà¸à¸²à¸£à¸à¸´à¹à¸à¹à¸¥à¸·à¸à¸à¸à¸°à¹à¸£à¹à¸ checkbox à¸à¸¸à¸à¹ à¹à¸¥à¸¢à¸à¸°à¸¡à¸µà¸à¸²à¸£à¸à¸·à¸à¸à¹à¸²à¹à¸à¹à¸ -1 253 checkboxs=-1; 254 } 255 256 return checkboxs; 257 258}// end function getCheckbox() 259 260//à¹à¸à¹à¹à¸à¹à¸à¸±à¸ object à¸à¸·à¹à¸à¹ à¸à¸à¸à¸à¸²à¸ checkbox, radio à¸à¹à¸§à¸¢ 261function getInput(obj_name){ 262 263 var values = document.getElementById(obj_name).value; 264 return values; 265 266}// end function getInput() 267 268//à¸à¸±à¸à¸à¹à¸à¸±à¸à¹à¸à¹à¹à¸à¸·à¹à¸ disable element à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£à¹à¸¡à¸·à¹à¸à¸à¸ checkbox à¹à¸à¸¢à¸£à¸±à¸à¸à¹à¸²à¸à¸·à¹à¸checkbox à¸à¸±à¸ elementname à¸à¸µà¹à¸à¹à¸à¸à¸±à¸à¸¡à¸²à¹à¸à¸¢à¹à¸à¹ ,(comma) à¸à¸±à¹à¸ 269function useSameData(checkboxName,elementName) 270{ 271 var element=elementName.split(","); 272 if(document.getElementById(checkboxName).checked==true) 273 { 274 for ( var i = 0; i < element.length; i++) 275 { 276 document.getElementById(element[i]).disabled=true; 277 } 278 279 } 280 else{ 281 for ( var i = 0; i < element.length; i++) 282 { 283 document.getElementById(element[i]).disabled=""; 284 } 285 } 286} 287 288function loadModuleInAjax(MyUrl,target){ //à¸à¸±à¸à¸à¹à¸à¸±à¸ load à¹à¸¡à¸à¸¹à¸¥à¹à¸à¸ ajax à¹à¸à¸¢à¸ªà¹à¸ url à¸à¸à¸à¹à¸¡à¸à¸¹à¸¥à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£à¹à¸«à¸¥à¸, à¹à¸¥à¸°à¸à¸³à¹à¸«à¸à¹à¸à¸à¸µà¹à¸à¸°à¹à¸«à¹à¹à¸ªà¸à¸à¸à¸¥ 289 var html=getVal(MyUrl); 290 $(target).html(html); 291} 292 293function loadVoteModuleInAjax(MyUrl,target){ //à¸à¸±à¸à¸à¹à¸à¸±à¸ load à¹à¸¡à¸à¸¹à¸¥à¹à¸à¸ ajax à¹à¸à¸¢à¸ªà¹à¸ url à¸à¸à¸à¹à¸¡à¸à¸¹à¸¥à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£à¹à¸«à¸¥à¸, à¹à¸¥à¸°à¸à¸³à¹à¸«à¸à¹à¸à¸à¸µà¹à¸à¸°à¹à¸«à¹à¹à¸ªà¸à¸à¸à¸¥ 294 var html=getVal(MyUrl); 295 $(target).html(html); 296 $(target).fadeIn('slow'); 297} 298 299var splitMyUrl=[]; 300var splitModule=[]; 301 302function loadMyModuleInAjax(moduleUrl,moduleDisplay){ 303 304 splitMyUrl2=moduleUrl.split(","); 305 splitModule2=moduleDisplay.split(","); 306 307 for(var j=0;j<splitModule2.length;j++){ 308// if(j==20){ 309// window.location = "http://www.google.com" 310// } 311 if($(splitModule2[j]).length){ 312 splitMyUrl.push(splitMyUrl2[j]); 313 splitModule.push(splitModule2[j]); 314 } 315 } 316 loadMyModule(); 317} 318 319function loadMyModule(){ 320 321 var getUrl=splitMyUrl.pop(); 322 var getDisplay=splitModule.pop(); 323 if(getUrl!="" && typeof(getUrl)!="undefined"){ 324 $(getDisplay).html("<img id='"+getDisplay+"_loading' src='/public/images/icon/load.gif'>"); 325 displayMyModule(getUrl,getDisplay); 326 327 } 328 329} 330 331function displayMyModule(MyUrl,MyDisplay){ 332 var splitMyUrl = MyUrl.split("/"); 333 334 $.ajax({ // à¹à¸à¹ ajax à¸à¹à¸§à¸¢ jQuery à¸à¸¶à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸à¸à¸²à¸à¸à¹à¸à¸¡à¸¹à¸¥ 335 url:MyUrl, 336 async:true, 337 success:function(data){ 338 // $("#"+MyDisplay+"_loading"); 339 $(MyDisplay).html(data); 340 loadMyModule(); 341 loadcountviewpage(); 342 } 343 }); 344 345 //loadMyModule(); 346 347} 348 349function loadcountviewpage(){ 350 $.ajax({ 351 url: '/public/statistic/data/showcountpage', 352 type: 'POST', 353 dataType: 'html', 354 data: {url:$(location).attr('href')}, 355 success:function(data){ 356 if ($.trim(data)!='disable'&&$.trim(data)!='') { 357 if (data==null||data=='') { 358 countnumber=0; 359 }else{ 360 countnumber=$.trim(data); 361 } 362 $('#show_number_count').text(countnumber); 363 } 364 365 }}) 366} 367function reportBox(target,errTxt,root,type){ 368 /*à¸à¸±à¸à¸à¹à¸à¸±à¸à¹à¸ªà¸à¸ error box à¹à¸à¸¢à¸à¹à¸à¸à¸ªà¹à¸à¸à¹à¸²à¸¡à¸²à¸à¸±à¸à¸à¸µà¹ 369 root : à¸à¸·à¸ /public/ à¸à¸µà¹à¹à¸à¹à¸à¸²à¸ $this->url(array(),"default",true) à¸à¹à¸²à¹à¸ªà¹à¸¡à¸²à¹à¸ªà¸à¸à¸£à¸¹à¸ à¸à¹à¸²à¹à¸¡à¹à¹à¸ªà¹à¹à¸¡à¹à¹à¸ªà¸à¸à¸£à¸¹à¸ 370 target : à¸à¸³à¹à¸«à¸à¹à¸à¸à¸µà¹à¸à¸°à¹à¸«à¹à¹à¸à¹à¸à¸£à¸ à¹à¸à¸¢à¸à¸°à¹à¸à¹à¸à¸£à¸à¸à¸µà¹à¸à¹à¸²à¸à¸à¸ à¹à¸à¹à¸à¸ªà¹à¸ #target 371 errTxt : à¸à¹à¸à¸à¸§à¸²à¸¡à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£à¹à¸«à¹à¹à¸ªà¸à¸ 372 type : à¸à¸·à¸à¸à¸£à¸°à¹à¸ à¸à¸à¸à¸ box à¸à¸µà¹à¸à¸°à¸¡à¸²à¹à¸ªà¸à¸à¸¡à¸µà¸à¸±à¸à¸à¸µà¹ success, warning, error, notice 373 */ 374 375 $("#content").remove(); 376 var code = ""; 377 var classImg = ""; 378 var pad=""; 379 code+="<div id='content'>"; 380 code+="<div id='box-tabs' class='box'>"; 381 code+="<div class='title'>"; 382 code+="</div>"; 383 384 code+="<div id='box-messages'>"; 385 code+="<div class='messages'>"; 386 if(root!=""){ 387 classImg="img img-"+type; 388 pad="img-pad"; 389 } 390 code+="<div id='message-error' class='message message-"+type+"'>"; 391 392 code+="<div class='text "+classImg+" "+pad+"' >"; 393 394 395 code+="<span>"+errTxt+"</span>"; 396 code+="</div>"; 397 code+="</div>"; 398 code+="</div>"; 399 400 $(target).prepend(code); 401} 402 403function removeBox(target){ 404 $(target).empty(); 405} 406 407//----- area selection -----// 408function listZone(zone_id,S_target,C1_target,C2_target,C3_target,link){ 409 410 var MyUrl = link+"area/area/zone"; 411 var data = "zone_id="+zone_id+"&C1_target="+C1_target+"&C2_target="+C2_target+"&C3_target="+C3_target; 412 413 MyAjax(MyUrl,data,S_target,""); 414} 415 416function listCountry(zone_id,country_id,S_target,C1_target,C2_target,isSelected,link){ 417 418 var MyUrl = link+"area/area/country"; 419 var data = "zone_id="+zone_id+"&country_id="+country_id+"&C1_target="+C1_target+"&C2_target="+C2_target; 420
421 var C1_Url = link+"area/area/province/country_id/"; 422 var data_c1 = "S_target="+C1_target+"&C1_target="+C2_target; 423 424 var C2_Url = link+"area/area/city/province_id/"; 425 var data_c2 = "S_target="+C1_target+"&C1_target="+C2_target; 426 427 if(isSelected!=""){ 428 MyAjax(MyUrl,data,S_target,""); 429 MyAjax(C1_Url,data_c1,C1_target,""); 430 MyAjax(C2_Url,data_c2,C2_target,""); 431 432 }else{ 433 MyAjax(MyUrl,data,S_target,""); 434 } 435} 436 437function listProvince(country_id,province_id,S_target,C1_target,isSelected,link){ 438 439 var MyUrl = link+"area/area/province"; 440 var data = "country_id="+country_id+"&province_id="+province_id+"&C1_target="+C1_target; 441 442 var C1_Url = link+"area/area/city/province_id/"; 443 var data_c1 = "S_target="+C1_target; 444 445 if(isSelected!=""){ 446 MyAjax(MyUrl,data,S_target,""); 447 MyAjax(C1_Url,data_c1,C1_target,""); 448 449 }else{ 450 MyAjax(MyUrl,data,S_target,""); 451 } 452} 453 454function listCity(province_id,city_id,S_target,link){ 455 456 var MyUrl = link+"area/area/city/province_id/"+province_id+"/city_id/"+city_id; 457 MyAjax(MyUrl,"",S_target,""); 458} 459//----- area selection -----// 460 461function globalCheckAllBox(obj,ele_name){ 462 463 //obj à¸à¸·à¸à¸ªà¹à¸ element à¸à¸±à¸§à¸à¸µà¹à¸à¸¥à¸´à¹à¸à¸¡à¸²(สà¹à¸ this มา) 464 //ele_name à¸à¸·à¸à¸ªà¹à¸à¸à¸·à¹à¸à¸à¸à¸ element checkbox à¸à¸±à¸§à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£à¹à¸«à¹ checked มา 465 var checked_status = obj.checked; 466 467 $("input[id="+ele_name+"]").each(function() 468 { 469 this.checked = checked_status; 470 }); 471} 472function scrollToTop(){ 473 window.parent.scrollTo(0,0); 474} 475 476function scrollToBottom(){ 477 window.parent.scrollTo(0,$(document).height()); 478} 479 480function loadHeadModule(menuid,target){ 481 var root = getRoot(); 482 loadModuleInAjax(root+'menu/data/loadhead/menuid/'+menuid,target); 483} 484 485 486function checkAndReload(link){ 487 var rootPath=getRoot(); 488 $(function(){ 489 setInterval(function(){ // à¹à¸à¸µà¸¢à¸à¸à¸±à¸à¸à¹à¸à¸±à¸ javascript à¹à¸«à¹à¸à¸³à¸à¸²à¸à¸à¸¸à¸ ๠30 วิà¸à¸²à¸à¸µ 490 // 1 วิà¸à¸²à¸à¸µà¹ à¹à¸à¹à¸² 1000 491 // à¸à¸³à¸ªà¸±à¹à¸à¸à¸µà¹à¸à¹à¸à¸à¸à¸²à¸£à¹à¸«à¹à¸à¸³à¸à¸²à¸ à¸à¸¸à¸ ๠10 วิà¸à¸²à¸à¸µ 492 var getData=$.ajax({ // à¹à¸à¹ ajax à¸à¹à¸§à¸¢ jQuery à¸à¸¶à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸à¸à¸²à¸à¸à¹à¸à¸¡à¸¹à¸¥ 493 url:rootPath+"backend/index/checklogin", 494 async:false, 495 success:function(getData){ 496 if(getData!=1){ 497 //window.parent.location = link; 498 } 499 } 500 }).responseText; 501 },15000); 502 }); 503} 504 505function in_array(needle, haystack, argStrict) { 506 // http://kevin.vanzonneveld.net 507 // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) 508 // + improved by: vlado houba 509 // + input by: Billy 510 // + bugfixed by: Brett Zamir (http://brett-zamir.me) 511 // * example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']); 512 // * returns 1: true 513 // * example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'}); 514 // * returns 2: false 515 // * example 3: in_array(1, ['1', '2', '3']); 516 // * returns 3: true 517 // * example 3: in_array(1, ['1', '2', '3'], false); 518 // * returns 3: true 519 // * example 4: in_array(1, ['1', '2', '3'], true); 520 // * returns 4: false 521 var key = '', 522 strict = !! argStrict; 523 524 if (strict) { 525 for (key in haystack) { 526 if (haystack[key] === needle) { 527 return true; 528 } 529 } 530 } else { 531 for (key in haystack) { 532 if (haystack[key] == needle) { 533 return true; 534 } 535 } 536 } 537 538 return false; 539} 540 541function voteRunning(votedata){ 542 var eachVote = votedata.split(","); 543 for(var i=0 ; i<eachVote.length; i++){ 544 var data = ""; 545 data = eachVote[i].split("_"); 546 $('#graph_'+data[0]).fadeIn('fast').animate({ 'width': data[1]+"%" },1300); 547 } 548} 549 550var popup_event = "false"; 551function prepareFestival(fesName,fesUrl,Valid){ 552 tb_show(fesName,fesUrl,Valid); 553} 554 555function preparePopup(popName,popUrl,Valid){ 556 tb_show(popName,popUrl,Valid); 557 popup_event="true" 558} 559 560function marqueeHotnews(){ 561 $("ul#marquee1").marquee({ 562 yScroll: "bottom", 563 scrollSpeed: 15, 564 pauseSpeed: 2000 565 }); 566} 567 568function callPopupAction(){ 569 var root = getRoot(); 570 $('#festival_display').html("<img id='#popup_display_loading' src='/public/images/icon/load.gif'>"); 571 displayMyModule(root+'popup/data/index','#festival_display'); 572} 573 574function fix_flash() { 575 // loop through every embed tag on the site 576 var embeds = document.getElementsByTagName('embed'); 577 for (i = 0; i < embeds.length; i++) { 578 embed = embeds[i]; 579 var new_embed; 580 // everything but Firefox & Konqueror 581 if (embed.outerHTML) { 582 var html = embed.outerHTML; 583 // replace an existing wmode parameter 584 if (html.match(/wmode\s*=\s*('|")[a-zA-Z]+('|")/i)) 585 new_embed = html.replace(/wmode\s*=\s*('|")window('|")/i, "wmode='transparent'"); 586 // add a new wmode parameter 587 else 588 new_embed = html.replace(/<embed\s/i, "<embed wmode='transparent' "); 589 // replace the old embed object with the fixed version 590 embed.insertAdjacentHTML('beforeBegin', new_embed); 591 embed.parentNode.removeChild(embed); 592 } else { 593 // cloneNode is buggy in some versions of Safari & Opera, but works fine in FF 594 new_embed = embed.cloneNode(true); 595 if (!new_embed.getAttribute('wmode') || new_embed.getAttribute('wmode').toLowerCase() == 'window') 596 new_embed.setAttribute('wmode', 'transparent'); 597 embed.parentNode.replaceChild(new_embed, embed); 598 } 599 } 600 // loop through every object tag on the site 601 var objects = document.getElementsByTagName('object'); 602 for (i = 0; i < objects.length; i++) { 603 object = objects[i]; 604 var new_object; 605 // object is an IE specific tag so we can use outerHTML here 606 if (object.outerHTML) { 607 var html = object.outerHTML; 608 // replace an existing wmode parameter 609 if (html.match(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")[a-zA-Z]+('|")\s*\/?\>/i)) 610 new_object = html.replace(/<param\s+name\s*=\s*('|")wmode('|")\s+value\s*=\s*('|")window('|")\s*\/?\>/i, "<param name='wmode' value='transparent' />"); 611 // add a new wmode parameter 612 else 613 new_object = html.replace(/<\/object\>/i, "<param name='wmode' value='transparent' />\n</object>"); 614 // loop through each of the param tags 615 var children = object.childNodes; 616 for (j = 0; j < children.length; j++) { 617 try { 618 if (children[j] != null) { 619 var theName = children[j].getAttribute('name'); 620 if (theName != null && theName.match(/flashvars/i)) { 621 new_object = new_object.replace(/<param\s+name\s*=\s*('|")flashvars('|")\s+value\s*=\s*('|")[^'"]*('|")\s*\/?\>/i, "<param name='flashvars' value='" + children[j].getAttribute('value') + "' />"); 622 } 623 } 624 } 625 catch (err) { 626 } 627 } 628 // replace the old embed object with the fixed versiony 629 object.insertAdjacentHTML('beforeBegin', new_object); 630 object.parentNode.removeChild(object); 631 } 632 } 633} 634function jqueryFlash(fdisplay,fpath,fwidth,fheight){ 635 636 $(fdisplay).flash( 637 { 638 src: fpath, 639 width: fwidth, 640 height: fheight 641 }, 642 { expressInstall: true } 643 ); 644 fix_flash(); 645 646} 647 648var lastClick=0; 649function tabsType1(obj,menu_path,menu_normal,menu_hover,menu_suffix
649){ 650 651 $("ul#"+obj+"_content > li:visible").hide(); 652 $("ul#"+obj+"_content > li:first").show(); 653 654 $("ul#"+obj+" > li:first").find("img").attr("src",menu_path+"/"+menu_hover+"1."+menu_suffix); 655 $("ul#"+obj+" > li:first").find("img").attr("class","tab_active"); 656 657 $("ul#"+obj+" > li").click(function(event){ 658 var menuIndex=$(this).index(); 659 lastClick=menuIndex; 660 $("ul#"+obj+"_content > li:visible").hide(); 661 $("ul#"+obj+"_content > li").eq(menuIndex).show(); 662 $("ul#"+obj+" > li").each(function(index) { 663 var menuID=(index+1); 664 $(this).find("img").attr("src",menu_path+"/"+menu_normal+menuID+"."+menu_suffix); 665 }); 666 menuCurrentID=(menuIndex+1); 667 $(this).find("img").attr("src",menu_path+"/"+menu_hover+menuCurrentID+"."+menu_suffix); 668 }); 669 670 671 $("ul#"+obj+" > li > img").each(function(index) { 672 673 var img_index=(index+1); 674 $(this).hover(function() { 675 $(this).attr("src",menu_path+"/"+menu_hover+img_index+"."+menu_suffix); 676 }, function() { 677 if(lastClick!=index){ 678 $(this).attr("src",menu_path+"/"+menu_normal+img_index+"."+menu_suffix); 679 } 680 }); 681 682 }); 683} 684 685function tabsType2(obj,img_path,img_name,img_ext){ 686 687 img_path = img_path+"/"; 688 img_ext = "."+img_ext; 689 img_active = "_active"; 690 691 $(document).ready(function(){ 692 $("ul#"+obj+"_content li:not(:first)").hide(); 693 $("ul#"+obj+"_content li:first").show(); 694 695 $("ul#"+obj+" li:first").next().addClass("tabs-selected");//add class tab to menu tabs 696 697 var onload_current_tabs = $("ul#"+obj+" li.tabs-selected"); 698 var onload_before_tabs = onload_current_tabs.prev(); 699 var onload_next_tabs = onload_current_tabs.next(); 700 701 var onload_before_image = img_path+img_name+"11"+img_active+img_ext; 702 onload_before_tabs.find("img").attr("src",onload_before_image); 703 704 var onload_current_image = img_path+img_name+"12"+img_active+img_ext; 705 onload_current_tabs.find("img").attr("src",onload_current_image); 706 707 var onload_next_image = img_path+img_name+"211"+img_active+img_ext; 708 onload_next_tabs.find("img").attr("src",onload_next_image); 709 710 $("ul#"+obj+" li > a").click(function(){ 711 var stringref = $(this).attr("href").split('#')[1]; 712 var next_id = parseInt(stringref) + parseInt(1); 713 714 var old_current_id = $("ul#"+obj+" li.tabs-selected a").attr("href").split('#')[1]; 715 var old_next_id = parseInt(old_current_id) + parseInt(1); 716 717 //----- old tabs image change -----// 718 var old_current_tabs = $("ul#"+obj+" li.tabs-selected"); 719 current_default_image = img_path+img_name+old_current_id+"2"+img_ext; 720 old_current_tabs.find("img").attr("src",current_default_image); 721 722 var old_prev_tabs = old_current_tabs.prev(); 723 prev_default_image = img_path+img_name+old_current_id+"1"+img_ext; 724 old_prev_tabs.find("img").attr("src",prev_default_image); 725 726 var old_next_tabs = old_current_tabs.next(); 727 var old_last_tabs = old_next_tabs.find("img").attr("src"); 728 729 var old_next_image = img_path+img_name+old_next_id+"1"+img_ext; 730 var old_last_image = img_path+"last"+img_ext; 731 if(old_last_tabs == img_path+"last"+img_ext || old_last_tabs == img_path+"last"+img_active+img_ext){ 732 old_next_tabs.find("img").attr("src",old_last_image); 733 }else{ 734 old_next_tabs.find("img").attr("src",old_next_image); 735 } 736 $("ul#"+obj+" li.tabs-selected").removeClass("tabs-selected"); //remove tabs-selected class 737 //----- old tabs image change -----// 738 739 //----- tabs image change -----// 740 var before_tabs = $(this).parent().prev(); 741 var before_image = img_path+img_name+stringref+"1"+img_active+img_ext; 742 before_tabs.find("img").attr("src",before_image); 743 744 var current_tabs = $(this).parent(); 745 var current_image = img_path+img_name+stringref+"2"+img_active+img_ext; 746 current_tabs.find("img").attr("src",current_image); 747 748 var next_tabs = $(this).parent().next(); 749 var last_tabs = next_tabs.find("img").attr("src"); 750 751 var next_image = img_path+img_name+next_id+"1"+stringref+img_active+img_ext; 752 var last_image = img_path+"last"+img_active+img_ext; 753 if(last_tabs == img_path+"last"+img_ext || last_tabs == img_path+"last"+img_active+img_ext){ 754 next_tabs.find("img").attr("src",last_image); 755 }else{ 756 next_tabs.find("img").attr("src",next_image); 757 } 758 $(this).parent().addClass("tabs-selected"); 759 //----- tabs image change -----// 760 761 $("ul#"+obj+"_content li:not(#content"+stringref+")").hide(); 762 if ($.browser.msie && $.browser.version.substr(0,3) == "6.0") { 763 $("ul#"+obj+"_content li#content"+stringref).show(); 764 }else{ 765 $("ul#"+obj+"_content li#content"+stringref).fadeIn(); 766 } 767 return false;
768 }); 769 }); 770} 771 772function sentSearchInfo(keyword,keywordtype){ 773 var root = getRoot(); 774 775 if(keywordtype==1){ 776 window.location = root+'search/data/findresult/keyword/'+keyword+'/menu/155'; 777 }else{ 778 window.open("http://www.google.co.th/search?q="+keyword,'',''); 779 } 780} 781 782$(document).ready(function() { 783// Create two variable with the names of the months and days in an array 784var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; 785var dayNames= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] 786// Create a newDate() object 787var newDate = new Date(); 788// Extract the current date from Date object 789newDate.setDate(newDate.getDate()); 790// Output the day, date, month and year 791$('#Date').html(dayNames[newDate.getDay()] + " " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ' ' + newDate.getFullYear()); 792setInterval( function() { 793 // Create a newDate() object and extract the seconds of the current time on the visitor's 794 var seconds = new Date().getSeconds(); 795 // Add a leading zero to seconds value 796 $("#sec").html(( seconds < 10 ? "0" : "" ) + seconds); 797 },1000); 798setInterval( function() { 799 // Create a newDate() object and extract the minutes of the current time on the visitor's 800 var minutes = new Date().getMinutes(); 801 // Add a leading zero to the minutes value 802 $("#min").html(( minutes < 10 ? "0" : "" ) + minutes); 803 },1000); 804setInterval( function() { 805 // Create a newDate() object and extract the hours of the current time on the visitor's 806 var hours = new Date().getHours(); 807 // Add a leading zero to the hours value 808 $("#hours").html(( hours < 10 ? "0" : "" ) + hours); 809 }, 1000); 810$(window).load(function() { 811 $(".se-pre-con").fadeOut('slow'); 812 }); 813 814});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.