// JavaScript Document

function categoryshow(dcat, other) {

	var dcat;
	var other;
	var splitted = other.split(",");
		
	for(i in splitted) {
		var yosh = splitted[i].toString();
		if (yosh != dcat) {			
			$("#" + yosh).slideUp("normal");
		}
	}
	
	$("#" + dcat).slideDown("slow");	
		
}

function loadingstuff() {
	
	$("#cbbuttons").fadeOut("slow", function() {
		$("#loader").fadeIn("slow");
	});
	
	
}

function checksearch(entrsrch) {
	
	var entrsrch;
	var srchstr = document.getElementById('searchbox').value;
	
	if (srchstr == entrsrch) {
		document.getElementById('searchbox').value = "";
	}else{
		if (srchstr == "") {
			document.getElementById('searchbox').value = entrsrch;
		}
	}
	
}

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;
	}

}

function loadcategoryjs(cattype) {
	
	var totcat = document.getElementById('totalnumcat').value.split("|");
	var cattype;
	
	for(i in totcat) {
		var catext = "prds_" + totcat[i];				
		if (cattype == totcat[i]) {					
			$("#" + catext).slideDown("fast");
		}else{
			document.getElementById(catext).style.display = 'none';
		}
	}
	
		
}

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);	
}

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);
}