/*$(document).ready(function(){
    
    function vt(vote,id) {

	var cc=document.getElementById("top_imp");
	cc.innerHTML="<img src=images/loader_imp.gif>";

	$.get("modules/picture_vote.php", { id: id,vote: vote },
		function(data){

			if(data){
				$("#top_imp").load("modules/ire_f_imp1.php", { id: id } );
			}

		});

    }



  });

*/





//////////////////////////////////////// Fire fox Support  /////////////////////////////////////////////////////////////////////////////
function vote_f(vote,id){  
var dd=document.getElementById("show_comments");
var cc=document.getElementById("top_imp");
cc.innerHTML="<table border=0><tr><td><img src=images/loader_imp.gif></td><td> Update score</td></tr></table>";
dd.innerHTML="<table border=0><tr><td><img src=images/loader2.gif></td><td valign='middle'><font color=#666666 size=2>Plese wait ....</font></td></tr></table>";
document.form1.action="modules/picture_vote.php?vote="+vote;
document.form1.submit();
//p_refresh(id);
re_f_imps('2',id);
var dd=document.getElementById("show_comments");
dd.innerHTML='<table width="270" border="0" cellpadding="0" cellspacing="0" height="28"><tr><td><a href="javascript:" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image6\',\'\',\'images/post2.gif\',1)"><img src="images/post1.gif" name="Image6" border="0" onclick="javascript:return comment_f(\''+id+'\');"></a></td></tr></table>';

var dd=document.getElementById("icomment");
dd.innerHTML='<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"><tr><td colspan="6" align="center"><textarea name="icomments" id="icomments" style="width:100%;" rows="5" style="BACKGROUND:#333333;COLOR:#111111;border:none; overflow:hidden;" onKeyDown="textCounter2(this,\'icomments\',500)" onKeyUp="textCounter2(this,\'icomments\',500)" onFocus="textCounter2(this,\'icomments\',500)"></textarea></td>    </tr>  </table>';

var dd=document.getElementById("show_comment");
dd.innerHTML='<table border="0"><tr><td><img src=images/loader_black.gif></td><td>  Loading comments ... ... Please wait!</td></tr></table>';
reload_comments(id);
}

function comment_f(id){
var dd=document.getElementById("show_comments");
dd.innerHTML="<table><tr><td><img src=images/loader2.gif></td><td valign='middle'><font color=#666666 size=2>Plese wait ....</font></td></tr></table>";
document.form1.action="modules/picture_comment.php?id="+id;
document.form1.submit();
reload_comment(id);
document.form1.reset();

}



function server_date(now_time) {    current_time1 = new Date(now_time);    current_time2 = current_time1.getTime() + 1000;    current_time = new Date(current_time2);    var timeserver =document.getElementById('server_time'); 	var H = current_time.getHours();	var i = current_time.getMinutes();	var s = current_time.getSeconds();	if(H<10){ H = '0' + H; }	if(i<10){ i = '0' + i; } 	if(s<10){ s = '0' + s; }    timeserver.innerHTML = H + ":" + i + ":" + s;    setTimeout("server_date(current_time.getTime())",1000); }

//////////////////////////////////////// Defualt IE  /////////////////////////////////////////////////////////////////////////////

function vote(vote,id){
var dd=document.getElementById("show_comments");
var cc=document.getElementById("top_imp");
cc.innerHTML="<table border=0><tr><td><img src=images/loader_imp.gif></td><td> Update score</td></tr></table>";
dd.innerHTML="<table border=0><tr><td><img src=images/loader2.gif></td><td valign='middle'><font color=#666666 size=2>Plese wait ....</font></td></tr></table>";
window.form1.action="modules/picture_vote.php?vote="+vote;
window.form1.submit();
//p_refresh(id);
re_f_imps('2',id);
var dd=document.getElementById("show_comments");
dd.innerHTML='<table width="270" border="0" cellpadding="0" cellspacing="0" height="28"><tr><td><a href="javascript:" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image6\',\'\',\'images/post2.gif\',1)"><img src="images/post1.gif" name="Image6" border="0" onclick="comment(\''+id+'\');"></a></td></tr></table>';

var dd=document.getElementById("icomment");
dd.innerHTML='<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"><tr><td colspan="6" align="center"><textarea name="icomments" id="icomments" style="width:99%;" rows="5" style="BACKGROUND:#333333;COLOR:#CCCCCC;"></textarea></td>    </tr>  </table>';

var dd=document.getElementById("show_comment");
dd.innerHTML='<table border="0"><tr><td><img src=images/loader_black.gif></td><td>  Loading comments ... ... Please wait!</td></tr></table>';
reload_comments(id);
}

function p_refresh(id){
var dd=document.getElementById("show_comments");
dd.innerHTML='<table width="270" height="28" cellpadding="0" cellspacing="0"><tr><td><a href="javascript:" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image6\',\'\',\'images/post2.gif\',1)"><img src="images/post1.gif" name="Image6" border="0" onclick="comment(\''+id+'\');"></a></td></tr></table>';

}

function reload_comment(id){
var dd=document.getElementById("show_comments");
dd.innerHTML='<table width="270" height="28" cellpadding="0" cellspacing="0"><tr><td><a href="javascript:" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Image6\',\'\',\'images/post2.gif\',1)"><img src="images/post1.gif" name="Image6" border="0" onclick="return comment_f(\''+id+'\');"></a></td></tr></table>';
GET('modules/icomment.php?id='+id, 'show_comment');
}

function comment(id){
var dd=document.getElementById("show_comments");
dd.innerHTML="<table><tr><td><img src=images/loader2.gif></td><td valign='middle'><font color=#666666 size=2>Plese wait ....</font></td></tr></table>";
document.form1.action="modules/picture_comment.php?id="+id;
document.form1.submit();
//reload_comment(id);
document.form1.reset();
reload_comment(id);
}


function add_image1(){
document.open("actions.php?op=addimage","imp","height=465,width=400");
}


function add_image_vip(){
document.open("actions.php?op=addimage_vip","imp","height=700,width=400");
}

function alert_txt(id){
document.open("actions.php?op=alertimage&id="+id,"imp","height=210,width=400");
}

function edit_image(id){
document.open("actions.php?op=editimage","editimp","height=420,width=400");
}

function del_image(id){
document.open("actions.php?op=deleteimage&id="+id,"delimp","height=400,width=400");
}

function del_image1s(id){
document.open("actions.php?op=deleteimage1s&id="+id,"delimp","height=400,width=400");
}

function edit_image(id){
document.open("actions.php?op=editimage&id="+id,"editimp","height=405,width=400");
}

function del_image1(id){
document.open("admin1.php?op=deleteimage&id="+id,"delimp","height=430,width=400");
}

function edit_image1(id){
document.open("admin1.php?op=editimage&id="+id,"editimp","height=590,width=400");
}


function ban_image(id){
document.open("admin1.php?op=banimages&id="+id,"banimp","height=300,width=400");
}

function unban_image(id){
document.open("admin1.php?op=unbanimages&id="+id,"banimp","height=300,width=400");
}


function ban_member(id){
document.open("admin1.php?op=banmember&id="+id,"bm","height=300,width=400");
}

function unban_member(id){
document.open("admin1.php?op=unbanmember&id="+id,"bm","height=300,width=400");
}

function send_mail(id){
document.open("admin1.php?op=sendmail&id="+id,"bm","height=300,width=550");
}



function new_pass(){
document.open("actions.php?op=newpassword","np","height=250,width=400");
}


function new_banner(){
document.open("actions.php?op=new_banner","nb","height=400,width=550");
}


function edit_banners(id,type){document.open("actions.php?op=edit_banners&id="+id+"&type="+type,"eb","height=400,width=550");} function delete_banners(id){document.open("actions.php?op=delete_banners&id="+id,"eb","height=150,width=400");} function re_f_imps(no,id){if(no==1){GET('modules/ire_f_imp.php', 'top_imp');}else{GET('modules/ire_f_imp1.php?id='+id, 'top_imp');}}


function GET(http, div_name) {
	var LINK_xmlhttp = false;
	try { LINK_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { LINK_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	catch (e) { try { LINK_xmlhttp = new XMLHttpRequest(); }
	catch (e) { LINK_xmlhttp = false; }}}
	if (!LINK_xmlhttp) return null;
	
	document.getElementById('load_div').style.visibility="visible";

	LINK_xmlhttp.open("GET", http, true);

	LINK_xmlhttp.onreadystatechange = function() {
		if (LINK_xmlhttp.readyState == 4) {
			document.getElementById('load_div').style.visibility="hidden";

			if (LINK_xmlhttp.responseText.indexOf("<script type=\"text/javascript\">") > -1) {
				var x = LINK_xmlhttp.responseText.indexOf("<script type=\"text/javascript\">") + "<script type=\"text/javascript\">".length;
				var y = LINK_xmlhttp.responseText.indexOf("</script>") - x;
				eval(LINK_xmlhttp.responseText.substr(x, y));
			}

			if (LINK_xmlhttp.responseText.indexOf('ALERT|') > -1) {
				var x = LINK_xmlhttp.responseText.indexOf('ALERT|') + "ALERT|".length;
				var y = LINK_xmlhttp.responseText.indexOf('|ENDALERT') - x;
				window.alert(LINK_xmlhttp.responseText.substr(x , y));
			} else
				document.getElementById(div_name).innerHTML = LINK_xmlhttp.responseText + ' ';
		}
	}

	LINK_xmlhttp.send(null);  
	return false;
}


function POST(http, div_name, frm_name) {
	var POST_xmlhttp = false;
	var frm = false
	var url = "";

	try { POST_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { POST_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	catch (e) { try { POST_xmlhttp = new XMLHttpRequest(); }
	catch (e) { POST_xmlhttp = false; }}}
	if (!POST_xmlhttp) return null;

	frm = document.getElementById(frm_name);

	document.getElementById('load_div').style.visibility="visible";

	url = "frm_name=" + frm_name;

	for (i = 0; i < frm.elements.length; i++) {
		frm.elements[i].disabled = true;
		if (frm.elements[i].type == "checkbox") {
			if (frm.elements[i].checked)
				frm.elements[i].value = 1;
			else
				frm.elements[i].value = 0;
		}
		url = url + "&" + frm.elements[i].name + "=" + escape(frm.elements[i].value);
	}

	POST_xmlhttp.open("POST", http, true);

	POST_xmlhttp.onreadystatechange = function() {
		if (POST_xmlhttp.readyState == 4) {
			document.getElementById('load_div').style.visibility="hidden";

			for (i = 0; i < frm.elements.length; i++) {
				if (frm.elements[i].type == "checkbox")
					frm.elements[i].checked = false;
				if (frm.elements[i].type == "password")
					frm.elements[i].value = "";
				frm.elements[i].disabled = false;
			}

			if (POST_xmlhttp.responseText.indexOf("<script type=\"text/javascript\">") > -1) {
				var x = POST_xmlhttp.responseText.indexOf("<script type=\"text/javascript\">") + "<script type=\"text/javascript\">".length;
				var y = POST_xmlhttp.responseText.indexOf("</script>") - x;
				eval(POST_xmlhttp.responseText.substr(x, y));
			}

			if (POST_xmlhttp.responseText.indexOf('ALERT|') > -1) {
				var x = POST_xmlhttp.responseText.indexOf('ALERT|') + "ALERT|".length;
				var y = POST_xmlhttp.responseText.indexOf('|ENDALERT') - x;
				window.alert(POST_xmlhttp.responseText.substr(x , y));
			} else
				document.getElementById(div_name).innerHTML = POST_xmlhttp.responseText + ' ';
		}
	}

	POST_xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	POST_xmlhttp.setRequestHeader("Content-length", url.length);
	POST_xmlhttp.setRequestHeader("Connection", "close");
	POST_xmlhttp.send(url);  

	return false;
}




function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}













function textCounter(field,counter,maxlimit,linecounter) {
// text width//
var fieldWidth = parseInt(field.offsetWidth);
var charcnt = field.value.length; 

// trim the extra text
if (charcnt > maxlimit) { 
field.value = field.value.substring(0, maxlimit);
}

else { 
// progress bar percentage
//var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
//document.getElementById(counter).style.width = parseInt((fieldWidth*percentage)/100)+"px";
document.getElementById(counter).value = charcnt;
}
}


function textCounter2(field,counter,maxlimit) {
var fieldWidth = parseInt(field.offsetWidth);
var charcnt = field.value.length; 

if (charcnt > maxlimit) { 
field.value = field.value.substring(0, maxlimit);
}
}



function shouts(){
$("#ld").html('<img src="images/loader_imp.gif">');
var msgs=$("#msgs").val();
document.getElementById("msgs").value='';
$.post("shout.php",{msgs:msgs,type:'post'},function(data){$("#shout").html(data);$("#ld").html('');});}

function toTop(id){ 
document.getElementById(id).scrollTop=0 
} 

defaultStep=1 
step=defaultStep 
function scrollDivDown(id){ 
document.getElementById(id).scrollTop+=step 
timerDown=setTimeout("scrollDivDown('"+id+"')",2) 
} 

function scrollDivUp(id){ 
document.getElementById(id).scrollTop-=step 
timerUp=setTimeout("scrollDivUp('"+id+"')",2) 
} 

function toBottom(id){ 
document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight 
} 

function toPoint(id){ 
document.getElementById(id).scrollTop=100 
} 

function del_cm(session,shoutdate){$.post("shout.php",{session:session,shoutdate:shoutdate,type:'del'},function(data){$("#"+shoutdate).fadeOut("slow");});}