if (window != top) {
top.location.href = location.href;
}

menu1 = new Image(83, 35);
menu1.src = "/images/menu-articles1.gif";
menu1_high = new Image(83, 35);
menu1_high.src = "/images/menu-articles2.gif";

menu2 = new Image(71, 35);
menu2.src = "/images/menu-videos1.gif";
menu2_high = new Image(71, 35);
menu2_high.src = "/images/menu-videos2.gif";

menu3 = new Image(74, 35);
menu3.src = "/images/menu-spiritual-quotes1.gif";
menu3_high = new Image(74, 35);
menu3_high.src = "/images/menu-spiritual-quotes2.gif";

menu4 = new Image(155, 35);
menu4.src = "/images/menu-spiritual-experiences1.gif";
menu4_high = new Image(155, 35);
menu4_high.src = "/images/menu-spiritual-experiences2.gif";

menu5 = new Image(169, 35);
menu5.src = "/images/menu-spiritual-media1.gif";
menu5_high = new Image(169, 35);
menu5_high.src = "/images/menu-spiritual-media2.gif";

menu6 = new Image(71, 35);
menu6.src = "/images/menu-store1.gif";
menu6_high = new Image(71, 35);
menu6_high.src = "/images/menu-store2.gif";

function glow(x, y) {
document.images[x].src=eval(y+'.src');
}

function url_encode(inputString) {    

//http://www.permadi.com/tutorial/urlEncoding/
               
  var encodedInputString = escape(inputString);
  encodedInputString=encodedInputString.replace("+", "%2B");
  encodedInputString=encodedInputString.replace("/", "%2F");
  return encodedInputString;
}

function sharePage(destination) {

//get javascript location and title
//else if disabled, fall back on hard php url in href

var current_page = url_encode(window.location.href);
var current_title = (window.document.title).replace(/\s/gi,"+"); //replace space with +	;

if (destination == "delicious") window.open("http://del.icio.us/post?url=" + current_page + "&title=" + current_title);
else if (destination == "digg") window.open("http://digg.com/submit?phase=2&url=" + current_page);
else if (destination == "facebook") window.open("http://www.facebook.com/sharer.php?u=" + current_page + "&t=" + current_title);
else if (destination == "myspace") window.open("http://www.myspace.com/Modules/PostTo/Pages/?u=" + current_page + "&t=" + current_title);
else if (destination == "twitter") window.open("http://twitter.com/home?status=" + current_title + " " + current_page);

}


function findLeetSpeak(text) {

forbiddenWords = new RegExp("( be4 | bef4 | any1 | evry1 | every1 | some1 | no1 | som1 | sum1 | @ | gf | bf | coz | cus | cuz | cos | wuz | waz | dis | ppl | gr8 | l8r | there4 | ur | urs | w/ | w/o | h8 | 2day | jst | tis | sumtimes | sumtin | dat | becoz | bcuz | bcoz | becuz | b/c | b/w | iz | abt | ya | wut | wat | prolly | da | wud | cud | shud | rlly | nd | u | idk | n | r | tht | hv | wht | nite | whn | der | dnt | knw | wnt | bt | nt | skwl | lyk | frm )", "i");

if (text.match(forbiddenWords)) {
	alert("Please don't use TXT talk such as '" + RegExp.$1 + "'");
	return true;
}
else {
	return false;
}
}

function findCurseWords(text) {

forbiddenWords = new RegExp("(fuck|asshole| ass |asswipe|bitch|nigger|cocksucker|douchebag| cock | cunt | pussy | slut | twat| wanker )", "i");

if (text.match(forbiddenWords)) {
	alert("Please don't use vulgarity such as '" + RegExp.$1 + "'");
	return true;
}
else {
	return false;
}
}

function findTextAbuse(text) {

forbiddenWords = new RegExp("[a-zA-Z0-9]{150,}", "i");
forbiddenSigns = new RegExp("[^a-zA-Z0-9]{40,}", "i");

if (text.match(forbiddenWords)) {
	alert("That's a bit long for a single word");
	return true;
}
else if (text.match(forbiddenSigns)) {
	alert("Please don't insert repetitive signs that long");
	return true;
}
else {
	return false;
}
}

function updateSelectField(select_form, current_field) {
	var field_found = 0;
	
	for (x = 0; x <= select_form.length; x++) {
		if (select_form.options[x].value == current_field) {
		field_found = x;
		break;
		}
	}
	select_form.options.selectedIndex = field_found;
}

function show_hide(element, animation) {
	
	if (element.style.display == "none") {
		if (animation == "slide") $(element).slideDown("slow"); //jquery effect
		else element.style.display = "block";
	}
	else {
		if (animation == "slide") $(element).slideUp("fast"); //jquery effect
		else element.style.display = "none";
	}
}
