﻿jQuery(document).ready(function($) {
    var padding = ($(document).width() - 980) / 2;
    $("#GalleryScroll").css("width",($(document).width()-padding) + "px");
	$('#coin-slider').coinslider({ width: 980,height:525,delay:8000});
	$(".contactform .txtName").bind("focus",function(e){
		if($(this).val()=="Your Name") $(this).val("");
		$(this).addClass("edited");
	}).bind("blur",function(e){
		if($(this).val()=="") $(this).removeClass("edited").val("Your Name");
	});
	$(".contactform .txtEmail").bind("focus",function(e){
		if($(this).val()=="Email") $(this).val("");
		$(this).addClass("edited");
	}).bind("blur",function(e){
		if($(this).val()=="") $(this).removeClass("edited").val("Email");
	});
	
	$("#GalleryScroll").smoothDivScroll();
	$(".categoryitem").bind("mouseover",function(e){
	    $(this).stop().fadeTo("fast",1);
	}).bind("mouseout",function(e){
	    $(this).stop().fadeTo("fast",0.5);
	});
});
function locdau(str)
{  
    str= str.toLowerCase();  
    str= str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g,"a");  
    str= str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g,"e");  
    str= str.replace(/ì|í|ị|ỉ|ĩ/g,"i");  
    str= str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g,"o");  
    str= str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g,"u");  
    str= str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g,"y");  
    str= str.replace(/đ/g,"d");  
    str= str.replace(/!|@|%|\^|\*|\(|\)|\+|\=|\<|\>|\?|\/|,|\.|\:|\;|\'| |\"|\&|\#|\[|\]|~|$|_/g,"-"); 
    /* tìm và thay thế các kí tự đặc biệt trong chuỗi sang kí tự - */ 
    str= str.replace(/-+-/g,"-"); //thay thế 2- thành 1- 
    str= str.replace(/^\-+|\-+$/g,"");  
    //cắt bỏ ký tự - ở đầu và cuối chuỗi  
    return str;  
}
function loadErrorImage(id,src)
{
   id.src = src;id.onerror = null;
}
