var xmlHttp; function dorate(vote,dlid)
{ currentOpac('commentpart', 30, 300); currentOpac('txtHint', 1, 300); xmlHttp=GetXmlHttpObject(); if (xmlHttp==null)
{ alert ("مرورگر شما قادر به پشتیبانی از ویژگیهای این سایت نیست"); return;}
var url="ajaxrate.php"; url=url+"?vote="+vote; url=url+"&dlid="+dlid; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null);}
function stateChanged()
{ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ document.getElementById("txtHint").innerHTML=xmlHttp.responseText; currentOpac('txtHint', 100, 300);}
}
function GetXmlHttpObject()
{ var xmlHttp=null; try
{ xmlHttp=new XMLHttpRequest();}
catch (e)
{ try
{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e)
{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
}
return xmlHttp;}

function opacity(id, opacStart, opacEnd, millisec) { var speed = Math.round(millisec / 100); var timer = 0; if(opacStart > opacEnd) { for(i = opacStart; i >= opacEnd; i--) { setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++;}
} else if(opacStart < opacEnd) { for(i = opacStart; i <= opacEnd; i++)
{ setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); timer++;}
}
}
function changeOpac(opacity, id) { var object = document.getElementById(id).style; object.opacity = (opacity / 100); object.MozOpacity = (opacity / 100); object.KhtmlOpacity = (opacity / 100); object.filter = "alpha(opacity=" + opacity + ")";}
function shiftOpacity(id, millisec) { if(document.getElementById(id).style.opacity == 0) { opacity(id, 0, 100, millisec);} else { opacity(id, 100, 0, millisec);}
}
function blendimage(divid, imageid, imagefile, millisec) { var speed = Math.round(millisec / 100); var timer = 0; document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; changeOpac(0, imageid); document.getElementById(imageid).src = imagefile; for(i = 0; i <= 100; i++) { setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); timer++;}
}
function currentOpac(id, opacEnd, millisec) { var currentOpac = 100; if(document.getElementById(id).style.opacity < 100) { currentOpac = document.getElementById(id).style.opacity * 100;}
opacity(id, currentOpac, opacEnd, millisec)
}
function arraypush(thearray,value) { thearraysize = getarraysizeh(thearray); thearray[thearraysize] = value;}
function arraypop(thearray) { thearraysize = getarraysize(thearray); retval = thearray[thearraysize - 1]; delete thearray[thearraysize - 1]; return retval;}
function bbcodeh(theform,bbcode,prompttext) { inserttext = prompt(tag_prompth+" ["+bbcode+"]xxx[/"+bbcode+"]",prompttext); if ((inserttext != null) && (inserttext != "")) { theform.comment_message.value += "["+bbcode+"]"+inserttext+"[/"+bbcode+"] "; theform.comment_message.focus();}
}
function namedlinkh(theform,thetype) { linktext = prompt(link_text_prompth,""); var prompttext; if (thetype == "url") { prompt_text = link_url_prompth; prompt_contents = "http://";} else { prompt_text = link_email_prompth; prompt_contents = "";}
linkurl = prompt(prompt_text,prompt_contents); if ((linkurl != null) && (linkurl != "")) { if ((linktext != null) && (linktext != "")) { theform.comment_message.value += "["+thetype+"="+linkurl+"]"+linktext+"[/"+thetype+"] ";} else { theform.comment_message.value += "["+thetype+"]"+linkurl+"[/"+thetype+"] ";}
}
theform.comment_message.focus();}
function smilie(thesmilie) { getActiveText(); var AddSmilie = " " + thesmilie + " "; AddText(AddSmilie);}
function standard_old(theform,text) { text = ' ' + text + ' '; if (theform.comment_message.createTextRange && theform.comment_message.caretPos) { var caretPos = theform.comment_message.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text; theform.comment_message.focus();} else { var selStart = theform.comment_message.selectionStart; var selEnd = theform.comment_message.selectionEnd; mozWrap(theform.comment_message, text, '')
theform.comment_message.selectionStart = selStart + text.length; theform.comment_message.selectionEnd = selEnd + text.length;}
}
function standard(theform,text) { if (theform.comment_message.createTextRange && theform.comment_message.caretPos) { var caretPos = theform.comment_message.caretPos; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;} else { theform.comment_message.value+=text
}
AddTxt = ""; theform.comment_message.focus();}
function mozWrap(txtarea, open, close) { var selLength = txtarea.textLength; var selStart = txtarea.selectionStart; var selEnd = txtarea.selectionEnd; if (selEnd == 1 || selEnd == 2)
selEnd = selLength; var s1 = (txtarea.value).substring(0,selStart); var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; return;}
function mouseover(el) { el.className = "raised";}
function mouseout(el) { el.className = "button";}
function mousedown(el) { el.className = "pressed";}
function mouseup(el) { el.className = "raised";}
var clientPC = navigator.userAgent.toLowerCase(); var clientVer = parseInt(navigator.appVersion); var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1)); var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
&& (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
&& (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1)); var is_moz = 0; var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1)); var is_mac = (clientPC.indexOf("mac")!=-1); if ((clientVer >= 4) && is_ie && is_win) { document.write("<style type=\"text/css\"> .button { background:#ECE9D8; color: #000000; padding: 1px; border: 1px solid #ECE9D8; }</style>");} else { document.write("<style type=\"text/css\"> .button { background:#ECE9D8; color: #000000; padding: 1px; border: 0px; }</style>");}
var postmaximum = 3333; function validate(myform) { if (postmaximum != 0) { if (myform.comment_message.value.length > 3333) { alert("طول پیام شما بیش از حد مجاز است؛ لطفا آنرا به 3333 کاراکتر کاهش دهید. طول فعلی پیام: "+myform.comment_message.value.length+"."); return false;} else if (myform.comment_message.value.length < 6) { alert("طول پیام شما بسیار کوتاه است؛ اسپم کردن موجب کاهش امتیاز شما خواهد شد"); return false;} else { return true;} } else { return true;}
}
function checkmesslength(myform) { if (postmaximum != 0) { message = "حداکثر اندازه مجاز پیام 3333 کاراکتر است";} else { message = "";}
alert("طول فعلی پیام شما "+myform.comment_message.value.length+" کاراکتر است."+message);}
function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
tag_prompth = "متن خود را برای قالب بندی وارد کنید:"; link_text_prompth = "متنی را که مایل هستید برای لینک نمایش داده شود وارد کنید - اختیاری"; link_url_prompth = "نشانی اینترنتی کامل لینک خود را وارد کنید"; link_email_prompth = "نشانی ایمیل مورد نظر را برای لینک وارد کنید"; tags = new Array(); function getarraysizeh(thearray) { for (i = 0; i < thearray.length; i++) { if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
return i;}
return thearray.length;}
if (document.images) {
    img1 = new Image();
	img2 = new Image();
    img1.src = "http://ebooks.ketabnak.com/templates/default/images/imagebox_loader.gif";
	img2.src = "http://ebooks.ketabnak.com/templates/default/images/overlay.png";
}