function fix_png(id){if(navigator.appVersion.match(/MSIE [0-6]\./)){$(id).each(function(){var background_image=$(this).css("backgroundImage");if(background_image!='none'){if(background_image.substring(4,5)=='"'){var img_src=background_image.substring(5,background_image.length-2)}else{var img_src=background_image.substring(4,background_image.length-1)}$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+img_src+"')"})}})}}function getSize(){if(self.innerHeight){myWidth=window.innerWidth;myHeight=window.innerHeight;myScroll=window.pageYOffset}else if(document.documentElement&&document.documentElement.clientHeight){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;myScroll=document.documentElement.scrollTop}else if(document.body){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;myScroll=document.body.scrollTop}if(window.innerHeight&&window.scrollMaxY){myScrollWidth=document.body.scrollWidth;myScrollHeight=window.innerHeight+window.scrollMaxY}else if(document.body.scrollHeight>document.body.offsetHeight){myScrollWidth=document.body.scrollWidth;myScrollHeight=document.body.scrollHeight}else{myScrollWidth=document.body.offsetWidth;myScrollHeight=document.body.offsetHeight}}function showLargePopup(){var popFullscreen=document.getElementById('fullscreen');var popLarge=document.getElementById('largepopup');var popLarge_bg=document.getElementById('largepopup_bg');if($('.show_large_popup_width').lenght>0){var width=parseInt($('.show_large_popup_width').val());alert(width);$("#largepopup").css({width:width+"px"});$("#largepopup_bg").css({width:width+"px"})}if($('.show_large_popup_height').lenght>0){var height=parseInt($('.show_large_popup_height').val());$("#largepopup").css({height:height+"px"});$("#largepopup_bg").css({height:height+"px"})}document.getElementById('start-download').className='show';getSize();popFullscreen.style.height=myScrollHeight+'px';popFullscreen.style.display='block';popLarge.style.left=((myWidth-popLarge.offsetWidth)/2)+'px';popLarge.style.top=(((myHeight-popLarge.offsetHeight)/2)+myScroll)+'px';popLarge.style.visibility='visible';popLarge_bg.style.left=((myWidth-popLarge.offsetWidth)/2+10)+'px';popLarge_bg.style.top=(((myHeight-popLarge.offsetHeight)/2)+myScroll+10)+'px';popLarge_bg.style.visibility='visible';$("#mach_luu_but_box").html("")}function hideLargePopup(){var popFullscreen=document.getElementById('fullscreen');var popLarge=document.getElementById('largepopup');var largepopup_bg=document.getElementById('largepopup_bg');largepopup_bg.style.visibility='hidden';popLarge.style.visibility='hidden';popFullscreen.style.display='none'}function htmlspecialchars(s,t,c){s=s.toString().replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');switch(t){case 0:case'ENT_NOQUOTES':return s;case 3:case 5:case'ENT_QUOTES':return s.replace(/"/g,'&quot;').replace(/'/g,'&#039;');case 2:case'ENT_COMPAT':default:return s.replace(/"/g,'&quot;')}}function htmlspecialchars_decode(signature){signature=signature.replace(/&amp;/g,"&");signature=signature.replace(/&quot;/g,'"');signature=signature.replace(/&lt;/g,"<");signature=signature.replace(/&gt;/g,">");signature=signature.replace(/&#039;/g,"'");return signature}function wordwrap(str,int_width,str_break,cut){var m=int_width,b=str_break,c=cut;var i,j,l,s,r;if(m<1){return str}for(i=-1,l=(r=str.split("\n")).length;++i<l;r[i]+=s){for(s=r[i],r[i]="";s.length>m;r[i]+=s.slice(0,j)+((s=s.slice(j)).length?b:"")){j=c==2||(j=s.slice(0,m+1).match(/\S*(\s)?$/))[1]?m:j.input.length-j[0].length||c==1&&m||j.input.length+(j=s.slice(m).match(/^\S*/)).input.length}}return r.join("\n")}function strip_tags(str){return str.replace(/<\/?[^>]+>/gi,"")}function trim(str,charlist){var whitespace;if(!charlist){whitespace=' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000'}else{whitespace=charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g,'\$1')}for(var i=0;i<str.length;i++){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(i);break}}for(i=str.length-1;i>=0;i--){if(whitespace.indexOf(str.charAt(i))===-1){str=str.substring(0,i+1);break}}return whitespace.indexOf(str.charAt(0))===-1?str:''}function truncate(str,num_char,sign){if(str){var new_str=str.substring(0,num_char)+sign;return new_str;}return '';}function changeStyleSubmitBtt(){$(".form-submit,#luu_lai, input[type='submit'], input[type='button']").each(function(){if($(this).attr("class")!="searchEventThiSinh_btt"){$(this).addClass("submitBtt");$(this).hover(function(){$(this).addClass("submitBttHover")},function(){$(this).removeClass("submitBttHover")})}})}function auto_scroll(anchor){var $target=$(anchor);$target=$target.length&&$target||$('[name='+anchor.slice(1)+']');if($target.length){var targetOffset=$target.offset().top;$('html,body').animate({scrollTop:targetOffset},1000);return false}}function changeBorder(id){$(id).each(function(){$(this).hover(function(){$(this).addClass("aBorder")},function(){$(this).removeClass("aBorder")})})}function changeStyleHover(id,cl){$(id).each(function(){$(this).hover(function(){$(this).addClass(cl)},function(){$(this).removeClass(cl)})})}function setCookie(name,value,expires,path,domain,secure){expires instanceof Date?expires=expires.toGMTString():typeof(expires)=='number'&&(expires=(new Date(+(new Date)+expires*1e3)).toGMTString());var r=[name+"="+escape(value)],s,i;for(i in s={expires:expires,path:path,domain:domain}){s[i]&&r.push(i+"="+s[i])}return secure&&r.push("secure"),document.cookie=r.join(";"),true}function getCookie(c_name){if(document.cookie.length>0){c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end))}}return""}function check_limit_chars(textbox_id,info_id,limit){var text=$(textbox_id).val();var textlength=text.length;if(textlength>limit){$(info_id).html('Đã hết '+limit+' kí tự.');$(textbox_id).val(text.substr(0,limit));return false}else{$(info_id).html('Còn lại '+(limit-textlength)+' kí tự.');return true}}function empty(mixed_var){return(mixed_var===""||mixed_var===0||mixed_var==="0"||mixed_var===null||mixed_var===false||(is_array(mixed_var)&&mixed_var.length===0))}function is_array(mixed_var){return(mixed_var instanceof Array)}function check_preg_matched(str){var text=str.toLowerCase();var pattern="/vulva|"+$('.badword_filter').val()+"|pennis/";var check=text.match(pattern);if(!empty(check)){alert('Bạn đang post bình luận chứa nội dung xấu. Bình luận này bị huỷ bỏ.');return false}return true}function show_image(speed,obj){$(obj).fadeTo(speed,1)}function check_all(master_id,slavor_id){$(slavor_id).attr("checked","checked");$(master_id).attr("checked","checked")}function un_check_all(master_id,slavor_id){$(slavor_id).attr("checked","");$(master_id).attr("checked","")}function do_check(master_id,slavor_id){var arr=$(slavor_id).get();for(i=0;i<arr.length;i++){if(!arr[i].checked){$(master_id).attr("checked","");return false}}$(master_id).attr("checked","checked");return true}function obj_call_check_all(master_id,slavor_id){if($(master_id).attr("checked")){un_check_all(master_id,slavor_id)}else{check_all(master_id,slavor_id)}}function do_check_all(master_id,slavor_id){if($(master_id).attr("checked")){check_all(master_id,slavor_id)}else{un_check_all(master_id,slavor_id)}}function confirmCheckDone(check_id,form_id,mess_false,mess_true){var check=false;$(check_id).each(function(){if(this.checked==true){check=true}});if(check==false){alert(mess_false)}else{if(confirm(mess_true)){$(form_id).submit()}}}function show_confirm(url,mess,action){if(mess!=null&&trim(mess,' ')!=''){if(confirm(mess)){if(action!=null&&action!=''){eval(action)}else{window.location=url}}}else{if(action!=null&&action!=''){eval(action)}else{window.location=url}}return true}function redirect(url){window.location=url}function ipro_casting_open(url){window.open(url,'_blank','fullscreen=1,scrollbars=1,directories=0,location=0,menubar=0,status=0,titlebar=0,toolbar=0,resizable=1')}function CreateBookmarkLink(){var title=document.title;var browser_name=navigator.appName;var url=window.location.href;if(url.indexOf("file:")>-1)url=window.location;if(browser_name=="Microsoft Internet Explorer"){window.external.AddFavorite(url,title)}else if(browser_name=="Netscape"){window.sidebar.addPanel(title,url,"")}else if(window.opera&&window.print){return true}else{alert('Trình duyệt của bạn không hỗ trợ chức năng này.')}}function setDefaultHomepage(e){var browser_name=navigator.appName;if(browser_name=="Microsoft Internet Explorer"){e.style.behavior='url(#default#homepage)';e.setHomePage('http://i-pro.vn')}} function str_replace(search,replace,subject){var f=search,r=replace,s = subject;var ra=is_array(r),sa=is_array(s),f=[].concat(f),r=[].concat(r),i=(s=[].concat(s)).length;while(j=0,i--){while(s[i]=s[i].split(f[j]).join(ra?r[j]||"":r[0]),++j in f){};};return sa?s:s[0];} function encode_text(str){if(str && str != '') return str_replace(['&','#','?','/'],['%26','%23','%3F','%2F'], str); return '';}

$(document).ready(function() {
    $('a[href*=#]').click(function() {
        if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
            auto_scroll(this.hash)
        }
    });
   
});