
var subscribeHTML;

function subscribeField(field,action){
	if( field.value == '(Your E-Mail Address)' && action == 'focus' ){
		field.value = '';
		field.className = 'subscribeField';
	}
	if( field.value == '' && action == 'blur' ){
		field.value = '(Your E-Mail Address)';
		field.className = 'subscribeFieldGray';
	}
}

function eMailField(field,action){
	if( field.value == '(Type Your Name Here)' && action == 'focus' ){
		field.value = '';
		field.className = 'subscribeField';
	}
	if( field.value == '' && action == 'blur' ){
		field.value = '(Type Your Name Here)';
		field.className = 'subscribeFieldGray';
	}
}


function subscribeChange( action, text, delay ){
	if( action == 'error' ){
		document.getElementById('subscribeError').innerHTML = text;
		if( delay > 0 ) setTimeout( "document.getElementById('subscribeError').innerHTML='';", (delay*1000) );
	}
	
	if( action == 'body' ){
		document.getElementById('subscribeError').innerHTML = '';
		subscribeHTML = document.getElementById('subscribeSpan').innerHTML;
		document.getElementById('subscribeSpan').innerHTML = text;
		if( delay > 0 ) setTimeout( "document.getElementById('subscribeSpan').innerHTML=subscribeHTML;", (delay*1000) );
	}
}

function closeSubscribeMessage(){
	document.getElementById('subscribeSpan').innerHTML=subscribeHTML;
}

function oWindow( name, width, height, url ){
	var features = new Array();
		features.push('height=' + height);
		features.push('width=' + width);
		features.push('status=no');
		features.push('toolbar=no');
		features.push('toolbar=no');
		features.push('location=no');
	window.open( url, name, features.join(',') );	
}

function setCookie( cookieName, cookieValue, cookieExpire ){
	var today = new Date();
	var expire = new Date();

	var init = today.getMonth() +'/'+ today.getDay() +'/'+ today.getYear() +' '+ today.getHours() +':'+ today.getMinutes();
	expire.setTime( today.getTime() + cookieExpire );
	var newDate = expire.getMonth() +'/'+ expire.getDay() +'/'+ expire.getYear() +' '+ expire.getHours() +':'+ expire.getMinutes();
	
	document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}

function readCookie(name){
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++){
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function setGoogleAdword(){
	if( location.search.substring(1).indexOf('ads=off') >= 0 ){
		setCookie( 'ads', 'off', (40*3600000000) );
		var loc = location.toString();
		var qStart = loc.search('ads=off');
		loc = loc.substr(0,qStart) + loc.substr(qStart+7);
		document.location = ( loc.substr( loc.length-1, 1) == '?' ) ? loc.substr( 0, loc.length-1 ) : loc;
	}else if( location.search.substring(1).indexOf('ads=on') >= 0 ){
		setCookie( 'ads', '', -360000000 );
		var loc = location.toString();
		var qStart = loc.search('ads=on');
		loc = loc.substr(0,qStart) + loc.substr(qStart+6);
		document.location = ( loc.substr( loc.length-1, 1) == '?' ) ? loc.substr( 0, loc.length-1 ) : loc;
	}
}
setGoogleAdword();