$(document).ready(function () {
    var winWidth = Number($(window).width());
    $('.languageList a').click(function () {
        var LanguageIDString = $(this).attr("id");
        var LanguageArray = LanguageIDString.split("common_language_");
        var LanguageIDArray=LanguageArray[1].split("_");
        var LanguageID = LanguageIDArray[0];
        var LCIDString = LanguageIDArray[1];
        setLanguage(LanguageID,LCIDString,$('.languagebox_head').attr("id"));
    });

});
function setLanguage(languageID,newLCIDString,oldLCIDString) 
{
    $.ajax({
        url: GLOBAL_BASE_PATH + "/index/Ajaxresetlanguage/",
        type: "POST",
        cache: false,
        global: false,
        data:
		{
			languageID:languageID,
			newLCIDString:newLCIDString,
			oldLCIDString:oldLCIDString
		},
        success: function (data) {
            if($.trim(data)!='')  
			{            
				window.location.href = data;
			}
			else if(oldLCIDString!='' && newLCIDString!='')
			{
				var newhref=   (location.href).replace('/'+oldLCIDString+'/','/'+newLCIDString+'/');
				window.location.href = newhref;
			} 
			else                           
			{
				window.location.reload();
			}	
        }
    });
}