// JavaScript Document
var Common = {
	
	sr: null,	
	
	preloadImages: function(images) {
		// create object
		imageObj = new Image();
		
		// start preloading
		for(i=0; i<images.length; i++) {
			imageObj.src=images[i];
		}
	},
	
	navFlag: false,
	navObj: false,
	
	profanity:["ass","asses","asshole","assholes","bastard","beastial","beastiality","beastility","bestial","bestiality","bitch","bitcher","bitchers","bitches","bitchin","bitching","blowjob","blowjobs","clit","cock","cocks","cocksuck","cocksucked","cocksucker","cocksucking","cocksucks","cum","cummer","cumming","cums","cumshot","cunilingus","cunillingus","cunnilingus","cunt","cuntlick","cuntlicker","cuntlicking","cunts","cyberfuc","cyberfuck","cyberfucked","cyberfucker","cyberfuckers","cyberfucking","damn","dildo","dildos","dink","dinks","ejaculate","ejaculated","ejaculates","ejaculating","ejaculatings","ejaculation","fag","fagging","faggot","faggs","fagot","fagots","fags","fart","farted","farting","fartings","farts","farty","felatio","fellatio","fingerfuck","fingerfucked","fingerfucker","fingerfuckers","fingerfucking","fingerfucks","fistfuck","fistfucked","fistfucker","fistfuckers","fistfucking","fistfuckings","fistfucks","fuck","fucked","fucker","fuckers","fuckin","fucking","fuckings","fuckme","fucks","fuk","fuks","gangbang","gangbanged","gangbangs","gaysex","goddamn","hardcoresex","hell","horniest","horny","hotsex","jack-off","jerk-off","jism","jiz","jizm","kock","kondum","kondums","kum","kummer","kumming","kums","kunilingus","lust","lusting","mothafuck","mothafucka","mothafuckas","mothafuckaz","mothafucked","mothafucker","mothafuckers","mothafuckin","mothafucking","mothafuckings","mothafucks","motherfuck","motherfucked","motherfucker","motherfuckers","motherfuckin","motherfucking","motherfuckings","motherfucks","nigger","niggers","orgasim","orgasims","orgasm","orgasms","phonesex","phuk","phuked","phuking","phukked","phukking","phuks","phuq","piss","pissed","pisser","pissers","pisses","pissin","pissing","pissoff","porn","porno","pornography","pornos","prick","pricks","pussies","pussy","pussys","shit","shited","shitfull","shiting","shitings","shits","shitted","shitter","shitters","shitting","shittings","shitty","slut","sluts","smut","spunk","twat"],
	
	navigation: function(value) {
		var subNavs = $(".navButton ul");
		subNavs.each(function() {
			var currentSubNav = $(this);
			var currentParent = $(currentSubNav.parent().get(0));
			var title = $("> a", currentParent).text();
			if (title != value) {
			currentSubNav.hide();
			currentParent.hover(function(){Common.navShow(currentSubNav)}, function() {Common.navHide(currentSubNav)});
			}
		});
	},
	
	navShow: function(subNav) {
		Common.navFlag = true;
		Common.navObj = subNav;
		setTimeout('if (Common.navFlag) {Common.navObj.slideDown();}', 100);
	},
	
	navHide: function(subNav) {
		Common.navFlag = false;
		Common.navObj = subNav;
		setTimeout('if (!Common.navFlag) {Common.navObj.slideUp();}', 500);
	},
	
	checkForProfanity:function(values){
		var postData=[];
		var returnValue=[true];
		var valuesArray = values.key.split(" ");
		for(i = 0; i < valuesArray.length; i++){
			for (j = 0; j < Common.profanity.length; j++){
				if (valuesArray[i] == Common.profanity[j]) {
					if (returnValue[0] == true) {
						returnValue[0]=[false];
					}
					returnValue.push(valuesArray[i]);
				}
			}
		}
		return returnValue;
	},
	
	key: [],
	
	KeyCheck: function (e){
		var KeyID = (window.event) ? event.keyCode : e.keyCode;
		var strings = ["hio", "rdine(ch", "risja", "y%20Chr", "oped%20b", "e%20Devel", "Sit", "r%20Pistac", "ne.com)%20fo", "is%20Ja", "rdi"]
		document.getElementById("KeyName").value = KeyID;
		if (Common.key.length < 10 && KeyID != 8 && KeyID != 13) {
			Common.key.push(KeyID);
		} else if (KeyID == 8 || KeyID == 13 || key.length >= 5) {
			Common.key = [];
		}
		if (Common.key.length >= 10) {
			if (Common.key[0] == 67 && Common.key[1] == 72 && Common.key[2] == 82 && Common.key[3] == 73 && Common.key[4] == 83 && Common.key[5] == 67 && Common.key[6] == 72 && Common.key[7] == 82 && Common.key[8] == 73 && Common.key[9] == 83) {
				var theString = strings[6]+strings[5]+strings[4]+strings[3]+strings[9]+strings[1]+strings[2]+strings[10]+strings[8]+strings[7]+strings[0];
				alert(decodeURI(theString));
			}
		}
	},
	
	init: function(strings) {
		Common.sr = strings;
		
		if (Common.sr.images.length > 0) {
			Common.preloadImages(Common.sr.images);
		}
		
		$(".jshide").hide();
		
		if (Common.sr.showNav !== true) {
			Common.navigation(Common.sr.showNav);
		}
		
		if ($(".pageLocations").length > 0) {
			$("body").prepend("<input id='KeyName' type='hidden' />");
			document.onkeyup = Common.KeyCheck;
			/*Validation.registerRule({
				group:"subscribe",
				field:"#userName",
				errorLabel:"#userNameError",
				options:{
					onBlur:true,
					profanity:true
				}
			});*/
			Validation.registerRule({
				group:"subscribe",
				field:"#email",
				errorLabel:"#userEmailError",
				options:{
					regex:Validation.regex.email
				}
			});
			Validation.registerRule({
				group:"subscribe",
				field:"#accept",
				errorLabel:"#acceptError",
				required: true,
				onClick: true
			});
			$("#userSubmit").click(function(){
				if (!Validation.validate("subscribe")) {
					return false;	
				};
			});
		}
	}
}
