//
/* open new centered window with scrolling ability */
/* USAGE: javascript:openWin('filename.html','windowname', width, height); */


function openWin(url,name,popW,popH) {
        version = navigator.appVersion;
	var w = 800, h = 600;

	if (document.all || document.layers) {
		w = screen.availWidth;
		h = screen.availHeight;
	}
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	window.open(url,name,'width=' + popW + ',height=' + popH + ',scrollbars=yes,toolbar=no,status=yes,resizable=no,top=' + topPos + ',left=' + leftPos);void(0);
        window.status = "";
}

function openFullScreen(url,name) {
	if (document.all || document.layers) {
		w = screen.availWidth;
		h = screen.availHeight;
	} else {
		w = window.screen.availWidth;
		h = window.screen.availHeight;
	}
	window.open(url,name,'width='+w+',height='+h+',fullscreen=no,scrollbars=auto,toolbar=no,status=yes,resizable=yes,top=0,left=0');void(0);
    window.status = "";
}



/* open new centered window without scrolling ability */
/* USAGE: javascript:openPop('filename.html','windowname', width, height); */


function openPop(url,name,popW,popH) {
        version = navigator.appVersion;
	var w = 800, h = 600;

	if (document.all || document.layers) {
		w = screen.availWidth;
		h = screen.availHeight;
	}
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	window.open(url,name,'width=' + popW + ',height=' + popH + ',scrollbars=no,toolbar=no,status=yes,resizable=no,top=' + topPos + ',left=' + leftPos);void(0);
}

//
function setIdProperty(id,property,value) {
	var styleObject = document.getElementById( id );
	if (styleObject != null) {
		styleObject = styleObject.style;
		styleObject[ property ] = value;
	}
}
//
// AJAX FUNCTIONS
// EDIT CAPTION
function addEmail_cb(resultVariable){
	var resultCheck = resultVariable.substring(0,6);
	if (resultCheck == "ERROR:"){
		document.getElementById("user-email").disabled=false;
		document.getElementById("email-outcome").innerHTML = resultVariable;
	} else {
		document.getElementById("email-form").innerHTML = resultVariable + " | [ <a href=\"feed://www.yourteriyaki.com/rss/updates.xml\">rss</a> ]";
	}
	//
	
}
function addEmail_js(){
	var email = document.getElementById("user-email").value;
	document.getElementById("user-email").disabled=true;
	//
	if (email != "you@email.com"){
		x_addEmail(email, addEmail_cb);
	}
}

//
function delEmail_cb(resultVariable){
	var resultCheck = resultVariable.substring(0,6);
	if (resultCheck == "ERROR:"){
		document.getElementById("user-email").disabled=false;
		document.getElementById("email-outcome").innerHTML = resultVariable;
	} else {
		document.getElementById("email-outcome").innerHTML = "";
		document.getElementById("email-form").innerHTML = resultVariable;
	}
	//
	
}

function delEmail_js(){
	var email = document.getElementById("user-email").value;
	document.getElementById("user-email").disabled=true;
	//
	if (email != "you@email.com"){
		x_delEmail(email, delEmail_cb);
	}
}