$(document).ready(function(){
	$(".s_img").css({opacity:0.5});
});

function hide_show_posts(id){
	if(document.getElementById(id).style.display == 'none'){
		$("#"+id).show("slow");
		
	}
	else {
		$("#"+id).slideUp("fast");
	}
};

function change_theme(name, dir){
		if(name == "light"){
			$("#change_theme").html("");
			$("#change_theme").html('<a onclick="change_theme(\'dark\', \''+dir+'\')"><strong>Dark Style</strong></a>');
			$("body").css({background:'#a3a3a3'});
			$("#header-top").css({background:"url("+dir+"images/header-top.png)"});
			$("#header-main").css({background:"url("+dir+"images/header-main.png)"});
			$("#header-bottom").css({background:"url("+dir+"images/header-bottom.png)"});
			$("#body-bg").css({background:"url("+dir+"images/body-bg.png)"});
			$("#footer").css({background:"url("+dir+"images/footer.png)"});
		}
		else if(name == "dark"){
			$("#change_theme").html("");
			$("#change_theme").html('<a onclick="change_theme(\'light\', \''+dir+'\')"><strong>Light Style</strong></a>');
			$("body").css({background:'#3c3c3c'});
			$("#header-top").css({background:"url("+dir+"images/dheader-top.png)"});
			$("#header-main").css({background:"url("+dir+"images/dheader-main.png)"});
			$("#header-bottom").css({background:"url("+dir+"images/dheader-bottom.png)"});
			$("#body-bg").css({background:"url("+dir+"images/dbody-bg.png)"});
			$("#footer").css({background:"url("+dir+"images/dfooter.png)"});
		}
};

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
};

function set_black_layer(id, id2, w, h){
	var left = getposOffset(id, "left") - 1;
	var top = getposOffset(id, "top");
	$("#"+id2).css({left:left+"px", top:top+"px", width:w+"px", height:h+"px", opacity:0.7});
};

function hide_show_black_layer(id, type){
	if(type == "hide"){
		$("#"+id).slideUp("fast");
	}
	else if(type == "show"){
		$("#"+id).slideDown("fast");
	}
};

function img_opacity(type, id){
	if(type == 1)
	$("#"+id).css({opacity:1});
	else if(type == 0)
	$("#"+id).css({opacity:0.5});
}

function check_dorc(id1, id2){
	if(document.getElementById(id1).style.display == 'block')
	$("#"+id2).hide("slow");
	else if(document.getElementById(id2).style.display == 'block')
	$("#"+id1).hide("slow");
}

function show_hide_ads(type, add){
	if(type == 1){
		$("#top_ads").slideDown("slow");
			if(document.getElementById("top_ads").src == 'm'){
				document.getElementById("top_ads").src = add;
			}
	}
	else if(type == 0){
		$("#top_ads").slideUp("slow");
	}
}

function bonload(add){
	document.getElementById("top_ads").src = add;
}