function get_deviceinfo(){
	$.ajax({
		type: "GET",
		url: "http://" + xc_gethost() + "/get_deviceinfo",
		dataType: "xml",
		cache: false,
		error: function () {
		},
		success: function (sxml) {
			var devicename = $(sxml).find("devicename").text();
			$('#device_name').val(devicename);
        }
    });
}

function DeviceInfo_setting(){
    var tmp = ""

    var devicename = $("#device_name").val();
    tmp += "devicename=" + devicename + "&";
    
    $.ajax({
        type: "GET",
        url: "http://" + xc_gethost() + "/set_deviceinfo" + "?" + tmp,
        cache: false,
        success: function (data) {
            var ret = $(data).find("return").text();
            if ("ok" == ret) {
                alert($.i18n.prop('deviceinfo_setting_success'));
            }
            else {
                alert($.i18n.prop('deviceinfo_setting_failed'));
            }
        },
        error: function (){
        	alert($.i18n.prop('deviceinfo_setting_failed'));
        }
    });
}

function language_setup() {
    jQuery.i18n.properties({
        name: 'common',
        path: '../lang/',
        mode: 'map',
        language: window.parent.get_language_setup(),
        callback: function () {
            $('#header_text').html($.i18n.prop('deviceinfo_header_text'));
            $('#device_name_txt').html($.i18n.prop('device_name_txt'));
            $('#deviceinfo_setting').val($.i18n.prop('deviceinfo_setting'));
        }
    });
}

$(function () {
	language_setup();
	get_deviceinfo();
});