/*************************************************************************
* Copyright (c) 2011 im007boy@gmail.com. All rights reserved.            *
* Use of this source code is governed by a BSD-style license that can be *
* found in the LICENSE file.                                             *
*************************************************************************/
var background = chrome.extension.getBackgroundPage();
function save(){
    localStorage["autoReplaceEnable"] = document.getElementById("autoReplaceEnable").checked;
/*     
	if (document.getElementById("auto_report_error").checked)
		localStorage["auto_report_error"] = "true";
	else
		localStorage["auto_report_error"] = "false";
        
 */	if(localStorage["autoReplaceEnable"] == "true")
		chrome.browserAction.setIcon({path:"./img/icon-auto.png"});
	else
		chrome.browserAction.setIcon({path:"./img/icon-half.png"});
	var status = document.getElementById("status");
	status.style.display = "block";
	status.innerHTML = "Saved";
	setTimeout(function() {
		status.innerHTML = "";
		status.style.display = "none";
  }, 850);
}
function init(){
	if(!localStorage["autoReplaceEnable"])
		localStorage["autoReplaceEnable"] = "false";
	if(localStorage["autoReplaceEnable"] == "true")
		document.getElementById("autoReplaceEnable").checked = true;
	else
		document.getElementById("autoReplaceEnable").checked = false;
/*         
	if(!localStorage["auto_report_error"])
		localStorage["auto_report_error"] = "true";
	if(localStorage["auto_report_error"] == "true")
		document.getElementById("auto_report_error").checked = true;
	else
		document.getElementById("auto_report_error").checked = false; 
        
 */	background.ga_push("[PageLoad]", location.hostname, location.pathname, 1);
}
