// JavaScript Document



var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
	
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
		if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);

}

function slidemenu_cb(totm, catid) {
	
	var totm;
	var catid
	var cdd = "catdd" + catid;	
	
		for(x = 1; x <= totm; x++) {	
			if (catid == x) {
				$("#" + cdd).slideDown("slow");
			}
		}
	
		for(var y = 1; y <= totm; y++) {	
			if (catid != y) {
				var cddx = "catdd" + y;
				$("#" + cddx).slideUp("slow");
			}	
		}
			
}

function displayarrow(arid, trigger) {
	
	var arid;
	var trigger;
	
	if (trigger == "1") {		
		$("#arrow" + arid).fadeIn("fast");
	}else{
		$("#arrow" + arid).fadeOut("fast");
	}
	
}

function checksearch(entrsrch, chck) {
	
	var entrsrch;	
	var chck;
	var srchstr = document.getElementById('searchbox').value;
	
	/* On Blur */
	if (chck == "1") {
		if (srchstr == '') {
			document.getElementById('searchbox').value = entrsrch;	
		}
	}
	
	/* On Focus */
	if (chck == "2") {
		if (srchstr == entrsrch) {
			document.getElementById('searchbox').value = "";	
		}
	}
		
}

function validatesearch(entrsrch) {

	var entrsrch;
	var sb = document.getElementById('searchbox').value;
	
	if ((sb == "") || (sb == entrsrch)) {
		
		$("#nosearch").fadeIn("normal", function() {
			//document.getElementById('nosearch').style.display = 'block';
			setTimeout('$("#nosearch").fadeOut("normal")', 6000)
		});
		
		return false;
	}else{
		
		$("#searchform").fadeOut("normal", function() {
			$("#searchload").fadeIn("normal");
		});
		return true;
	}

}

jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}

function lightboximg(imgp) {

	var imgp; 
	
	clearTimeout();
	document.getElementById('imgbox').innerHTML = "<img src=\"" + imgp + "\" alt=\"Cashburners\" />";
	$("#lbox").center();
	$("#lbox").fadeIn("normal");
	setTimeout('$("#lbox").fadeOut("normal")', 8500);
	$("#lbox").css("z-index","100");

}

function closelightbox() {
	setTimeout('$("#lbox").fadeOut("normal")', 10);	
}

function loadingstuff() {
	
	$("#cbbuttons").fadeOut("slow", function() {
		$("#loader").fadeIn("slow");
	});
		
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
		if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
		settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);
}
