
if(top!=self)top.location.href=location.href;var timerId=null;var mainPictureSelectDelay=5000;var url=location.href;var myRegexp=new RegExp("(?:^http://)(?:.*?/)(.+?)/","g");var match=myRegexp.exec(url);var urlLinkService='/'+match[1]+'/LinkService.svc/GetUrls';var init=false;$(document).ready(function(){TabClicked(1);MainPictureClicked(0);if($.browser.msie){var thumbHoz=$('#HorizThumbPanel');init=(thumbHoz!=null);if(init){thumbHoz.cycle({fx:'scrollHorz',timeout:0,next:'#NextThumb',prev:'#PrevThumb'});}}
else{init=false;}
timerId=window.setInterval(MainPictureAutoSelect,mainPictureSelectDelay);$('div[class^=TextLink]:not(:has(ul))').each(function(i){var id=this.id;id=id.replace("Link","");$('#'+id).css("display","none");});$('div[class^=IconLink]:not(:has(ul))').each(function(i){var imageSource='/WebImages/'+this.id+'.jpg';var dynImage=$("<img src='"+imageSource+"' alt='' />");$(this).append(dynImage);});var footerPosition=$('#footer').position();if(footerPosition!=null){$('#leftSide').css("height",footerPosition.top);}
var searchBoxDefault=" Tìm Kiếm ...";var txtSearchCtrl=$('#txtSearch');if(txtSearchCtrl!=null){txtSearchCtrl.focus(function(){if($(this).attr("value")==searchBoxDefault)
$(this).attr("value","");$(this).css("background","#ffffcc");});txtSearchCtrl.blur(function(){if($(this).attr("value")=="")$(this).attr("value",searchBoxDefault);$(this).css("background","#ffffff");});$('input#txtSearch').keypress(function(e){if(e.keyCode=='13'){e.preventDefault();SearchText();}});$('input#txtSearchLink').keypress(function(e){if(e.keyCode=='13'){e.preventDefault();SearchLink();}});}
$('a[href=#1]').click(onJavascriptLink);$('#dialog').dialog({autoOpen:false,width:500,height:250});});function onJavascriptLink(){$('#dialog').dialog('open');return false;}
function MainPictureAutoSelect(){if(init==false){init=true;var thumbHoz=$('#HorizThumbPanel');if(thumbHoz!=null){thumbHoz.cycle({fx:'scrollHorz',timeout:0,next:'#NextThumb',prev:'#PrevThumb'});}}
var thumbs=$("#MainPictureThumbs").find("img[class]");if(thumbs==null)return;var thumbLength=thumbs.length;if(thumbLength==0)return;var currentIndex=0;thumbs.each(function(i){if(this.className=="MainPictureThumb ThumbActive"){this.className="MainPictureThumb";currentIndex=i;}});currentIndex++;if(currentIndex==thumbLength)currentIndex=0;MainPictureClicked(currentIndex);}
function SearchText(){var txtSearchCtrl=document.getElementById("txtSearch");if(!txtSearchCtrl)return false;if(txtSearchCtrl.value.length<3||txtSearchCtrl.value=="Xin cho biết tựa bài"){alert("Xin cho biết tựa bài tối thiểu 3 chữ");txtSearchCtrl.focus();}
else{location.href="/News/Clients/Search.aspx?keywords="+encodeURIComponent(txtSearchCtrl.value);}
return false;}
function TabClicked(index){var tabHeader=document.getElementById("tabheader");if(tabHeader){var lis=tabHeader.getElementsByTagName("LI");for(var i=0;i<lis.length;i++){lis[i].className=(i==index)?"current":"";tab=document.getElementById("tab"+(i+7));if(tab){tab.className=(i==index)?"TabContainerActive":"TabContainer";}}}
return false;}
function MainPictureClicked(index){$("#MainPicture").find("div[class]").each(function(i){this.className=(i==index)?"Layout9Active":"Layout9";});$("#MainPictureThumbs").find("img[class]").each(function(i){this.className=(i==index)?"MainPictureThumb ThumbActive":"MainPictureThumb";});return false;}
function MainPictureClickedIndex(evt){window.clearInterval(timerId);evt=(evt)?evt:((window.event)?event:null);if(!evt)return false;var elem=(evt.target)?evt.target:((evt.srcElement)?evt.srcElement:null);if(!elem)return false;var id=elem.getAttribute('title');$("#MainPicture").find("div[class]").each(function(i){this.className=(this.id==id)?"Layout9Active":"Layout9";});$("#MainPictureThumbs").find("img[class]").each(function(i){this.className=(this.getAttribute('title')==id)?"MainPictureThumb ThumbActive":"MainPictureThumb";});timerId=window.setInterval(MainPictureAutoSelect,mainPictureSelectDelay);}
function OnShowHideSection(index){var section=$('#SectionBody'+index);if(section!=null){section.css("display",(section.css("display")=="none")?"block":"none");}}
var varType;var varUrl;var varData;var varContentType;var varDataType;var varProcessData;function CallService(){$.ajax({type:varType,url:varUrl,data:varData,contentType:varContentType,dataType:varDataType,processdata:varProcessData,success:function(msg){ServiceSucceeded(msg);},error:ServiceFailed});}
function ServiceSucceeded(result){var respondData=result.d;var searchResultsCtrl=$('#ulResults');if(searchResultsCtrl!=null){searchResultsCtrl.html('');for(var i=0;i<respondData.length;i++){var t=$("<li><a href='"+respondData[i].Url+"'>"+respondData[i].Caption+"</a></li>");searchResultsCtrl.append(t);}}};function ServiceFailed(result){alert('Service call failed: '+result.status+''+result.statusText);varType=null;varUrl=null;varData=null;varContentType=null;varDataType=null;varProcessData=null;}
function SearchLink(){var search=$('#txtSearchLink').attr("value");varType="POST";varUrl=urlLinkService;varData='{"textSearch":"'+search+'"}';varContentType="application/json; charset=utf-8";varDataType="json";varProcessData=true;CallService();}
