(function(a){a.fsoverlay=function(b){a.fsoverlay.options=a.fn.extend({},a.fsoverlay.defaults,b)};a.fsoverlay.show=function(f,d,c){if(a.fsoverlay.options==undefined){a.fsoverlay.options=a.fsoverlay.defaults}if(c!=undefined){a.fsoverlay.options=a.fn.extend(a.fsoverlay.options,c)}if(f==undefined||d==undefined){return false}var e=a.fsoverlay.options;a(window).unbind("resize.fsoverlayresize");a("#"+e.content+",#"+e.container).remove();var b=parseInt(a(window).scrollTop());a(document.body).append("<div id='"+e.container+"' onClick='$.fsoverlay.hide();' class='fsoverlay_bg' style='position: fixed; display: none; left: 0; top: 0; background-color: "+e.bgcolor+"; z-index: "+e.zindex+";'></div><div id='"+e.content+"' class='fsoverlay_content' style='position: fixed; left: 0; top: 0; "+(e.contentbgcolor!=""&&e.contentbgcolor!=null?"background-color: "+e.contentbgcolor+";":"")+"z-index: "+(parseInt(e.zindex)+1)+";'></div>");
a("#"+e.content+",#"+e.container).fadeTo(0,0).css("display","block");a(window).bind("resize.fsoverlayresize",function(){var h=a(window).width(),g=a(window).height();a("#"+e.container).width(h).height(g);a("#"+e.content).html(f).css("left",(h-a("#"+e.content).outerWidth(true))/2).css("top","15%")}).trigger("resize.fsoverlayresize");a("#"+e.content+",#"+e.container).fadeTo(e.fadein,e.opacity,function(){a("#"+e.content).fadeTo(0,1);d(e.content,e.container)});return false};a.fsoverlay.hide=function(){if(a.fsoverlay.options==undefined){return false
}var b=a.fsoverlay.options;a("#"+b.content).fadeTo(0,a("#"+b.container).css("opacity"));a("#"+b.content+",#"+b.container).fadeTo(b.fadeout,0,function(){a(window).unbind("resize.fsoverlayresize");a("#"+b.content+",#"+b.container).remove()});return true};a.fsoverlay.defaults={container:"fsoverlaycontainer",content:"fsoverlaycontent",zindex:1001,opacity:0.7,bgcolor:"#000000",contentbgcolor:"",fadein:150,fadeout:500}})(jQuery);jQuery.fn.highlight=function(b){function a(e,j){var l=0;if(e.nodeType==3){var k=e.data.toUpperCase().indexOf(j);
if(k>=0){var h=document.createElement("span");h.className="highlight";var f=e.splitText(k);var c=f.splitText(j.length);var d=f.cloneNode(true);h.appendChild(d);f.parentNode.replaceChild(h,f);l=1}}else{if(e.nodeType==1&&e.childNodes&&!/(script|style)/i.test(e.tagName)){for(var g=0;g<e.childNodes.length;++g){g+=a(e.childNodes[g],j)}}}return l}return this.each(function(){a(this,b.toUpperCase())})};jQuery.fn.removeHighlight=function(){return this.find("span.highlight").each(function(){this.parentNode.firstChild.nodeName;
with(this.parentNode){replaceChild(this.firstChild,this);normalize()}}).end()};function exchange_elements(b,c,a){if(c>(b.length-1)){c=c%(b.length-1)}for(i=0;i<=(b.length);i++){$("#"+b[i]).hide()}if($("#"+b[c]).is(":hidden")){$("#"+b[c]).show("clip","slow")}return true}function navigate_main_topics(b,a){if(b=="stop"){if(typeof reptimeout!=="undefined"){clearInterval(reptimeout);clearTimeout(reptimeout);reptimeout=null;delete reptimeout}return true}else{if(b>0){cur_main_topic=parseInt(b)}else{cur_main_topic=parseInt(cur_main_topic)
}if(cur_main_topic>4){cur_main_topic=1}document.getElementById("mainn_topics_1").style.display=document.getElementById("mainn_topics_2").style.display=document.getElementById("mainn_topics_3").style.display=document.getElementById("mainn_topics_4").style.display="none";$("#mainn_topics_"+cur_main_topic).fadeIn();document.getElementById("mainn_topics_"+cur_main_topic).style.display="block";cur_main_topic=parseInt(cur_main_topic)+1}if(a==true&&typeof reptimeout=="undefined"){reptimeout=setInterval("navigate_main_topics(cur_main_topic,true)",7000)
}return true}jQuery.fn.center=function(a,b){if(a=="fixed"){this.css("position","fixed");var d=($(window).width()-this.width())/2+"px";var c=($(window).height()-this.height())/2+"px"}else{this.css("position","absolute");var d=($(window).width()-this.width())/2+$(window).scrollLeft()+"px";var c=($(window).height()-this.height())/2+$(window).scrollTop()+"px"}if(!(b>=0)){b=400}this.animate({left:d,top:c},b);return this};jQuery.fn.focus_elem=function(){$.fsoverlay.show(this.html(),function(b,a){},{});
return this};function focus_elem(a,b){elem_id=a.attr("id");$("#"+elem_id).hide();$("#"+b).html('<div class="focus_bg" style="background-color:#000000; width:100%; height:100%; opacity:0.5; filter:alpha(opacity=50);"></div><div class="focus_elem" style="text-align:center;">'+$("#"+elem_id).html()+"</div>");$("#"+b).attr("style","z-Index:999; width:100%; height:100%;");$("#"+b).center();$("#"+b+" .focus_bg").center();$("#"+b+" .focus_elem").center();$("#"+b+" .focus_bg").click(function(){$("#"+b).fadeOut("slow");
$("#"+b).html("")});if(a!=="_HIDE_"){$("#"+b).fadeTo("fast",0.5);$("#"+b).fadeTo("slow",1)}else{$("#"+b).fadeOut("slow")}return true}function focus_elem_old(a,b){bg=document.getElementById(b);elem=document.getElementById(a);$("#"+b).attr("style","background-color:#000000; left:0px; top:0px; width:100%; height:100%; z-index:3; opacity:0.5; filter:alpha(opacity=50); display:none;");$("#"+b).css("height",$(document).height());$("#"+b).css("zIndex","99");$("#"+a).css("zIndex","100");$("#"+b).center();
$("#"+a).center();if(bg.style.display=="none"){$("#"+b).fadeTo("slow",0.7);$("#"+a).fadeIn("slow");bg.onclick=function(){focus_elem_old(a,b)}}else{$("#"+a).fadeOut("slow");$("#"+b).fadeOut("slow")}return true}function expandCollapse(c,a,b){a.push(c);exchange_elements(a,(a.length-1),b)}function disableselect(a){if(a==true){if($.browser.msie){document.onselectstart=function(){return false}}else{document.onmousedown=function(){return false}}var b=0;document.onkeydown=function(c){cur_key=(c.keyCode>0?c.keyCode:c.charCode);
if(((b+cur_key)==(17+65)||(b+cur_key)==(17+67))&&b==17){return false}b=cur_key}}else{if(a==false){document.onselectstart=document.onmousedown=document.onkeypress=function(){return true}}else{if(a=="init"){$("input, textarea, select").each(function(){$(this).attr("onselectstart",$(this).attr("onselectstart")+"; return true;");$(this).attr("onmousedown",$(this).attr("onmousedown")+"; this.focus(); return true;")})}}}}function insert_tag(c,d,f){f.focus();if(document.selection){var e=document.selection.createRange();
var g=e.text;if(e.parentElement()!==f){return false}document.selection.createRange().text=c+g+d}else{if(f.selectionStart&&f.selectionEnd){var b=f.selectionStart;var a=f.selectionEnd;f.value=f.value.substr(0,b)+c+f.value.substr(b,a-b)+d+f.value.substr(a)}}}function confirm_action(c,b){var a=confirm(c);if(a){window.location=b;return true}else{return false}}function CopyToClipboard(a){var c=a;var b=window.clipboardData.getData("Text");copy=window.clipboardData.setData("Text",c);if(copy){alert("لقد تم النسخ")
}else{document.execCommand("Copy");alert("XxX لم يتم النسخ XxX")}}function move(e,c,f){var d=e.options.length-1;var b=new Array;var a=new Array;if(c==-1){return false}if(f==+1&&c==d){return false}if(f==-1&&c==0){return false}for(i=d;i>=0;i--){b[i]=e.options[i].text;a[i]=e.options[i].value}for(i=d;i>=0;i--){if(c==i){e.options[i+f]=new Option(b[i],a[i],0,1);e.options[i]=new Option(b[i+f],a[i+f]);i--}else{e.options[i]=new Option(b[i],a[i])}}e.focus()}function submit_list_form(b,c){var a="&";for(i=0;
i<=c.options.length-1;i++){a+=c.name+"["+(i+1)+"]="+c.options[i].value;if(i!=c.options.length-1){a+="&"}}b.action+=a;window.location=b.action}function resized_image(a){max_width=300;max_height=500;image=new Image();image.src=a;image_width=image.width;image_height=image.height;if(image_width>max_width){Dif=max_width/image_width}else{if(image_height>max_height){Dif=max_height/image_height}else{Dif=1}}new_width=image_width*Dif;new_height=image_height*Dif;var b='<img src="'+a+'" width="'+new_width+'" height="'+new_height+'" onmouseover="this.style.cursor=\'hand\'" onClick="var site_image_preview = window.open(\''+a+"','image_preview','scrollbars=1,toolbar=0,resizable=1,width=400,height=400'); site_image_preview.focus();\" onmouseout=\"this.width="+new_width+"; this.height="+new_height+';" border="1" style="float:left; clear:both; margin:2px;">';
return b}function validate_form(b,a){function d(f){if(f=="0"){alert("من فضلك تأكد من ملء جميع البيانات المطلوبة بطريقة صحيحة");return false}else{var h=document.getElementsByTagName("input");for(var e=0;e<=h.length;e++){var g=h[e];if(g.getAttribute("type")=="submit"){g.disabled=true}}return true}}var c=document.getElementById(b);valid=true;for(input in a){$("*[name='"+a[input]+"']").each(function(){if($(this).parents("form").first().attr("name")==b){if(!($(this).val().length>0)){$(this).focus();valid=false
}}else{}});if(valid==false){return d(0);break}}return d(1)}function serialize(a){var b="";$(a+" > input:not([type=checkbox]), input[type=radio], input[type=text], input[type=hidden], input[type=checkbox]:checked, input[type=checkbox]:selected, select, textarea").each(function(){var c=$(this).attr("name");var d=$.URLEncode($(this).val());b=b+""+c+"="+d+"&"});return b}function ajax_submit_form(f,d,c,e,a){var b=$(c).serialize();ajax_call(f,d,b,"#"+a,e);return false}function ajax_call(f,d,c,b,e){if(e==true){var e=write_loader(32,32,false)
}if(b==true){b="#"+$(form).attr("id")}else{if(!($(b))){b=false}}if(typeof b!=="undefined"&&b!==false){if(typeof b=="string"){$(b).html(e);$(b).show()}else{for(i=0;i<=(b.length);i++){$(b[i]).html(e);$(b[i]).show()}}}var a="Error while loading data ... please retry";$.ajax({url:d,contentType:"application/x-www-form-urlencoded;charset=UTF-8",enctype:"multipart/form-data",type:f,dataType:"text",data:c,error:(function(){if(typeof b!=="undefined"&&b!==false){if(typeof b=="string"){$(b).html(a)}else{for(i=0;
i<=(b.length);i++){$(b[i]).html(a)}}}}),success:(function(g){if(typeof b!=="undefined"&&b!==false){if(typeof b=="string"){$(b).html(g);$(b).hide();$(b).fadeIn("fast")}else{for(i=0;i<=(b.length);i++){$(b[i]).html(g);$(b[i]).hide();$(b[i]).fadeIn("fast")}}}})})}function toJSON(a){var_return="{";for(x in a){if(a[x].constructor==Array){var_return=var_return+'"'+x+'":'+toJSON(a[x])+","}else{var_return=var_return+'"'+x+'":"'+a[x].replace('"','"')+'",'}}var_return=var_return.substring(0,var_return.length-1)+"}";
return var_return}function write_loader(b,a,d){if(d==true){d="جارى التحميل ..."}if(typeof d=="string"){d="<br>"+d}else{d=""}var c="";c=c+'<span id="loading" style="width:'+b+'px;">';c=c+'<object type="application/x-shockwave-flash" data="http://www.bilakoyod.net/images/loader4.swf" width="'+b+'" height="'+a+'"><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><param name="movie" value="http://www.bilakoyod.net/images/loader4.swf" /></object>';
c=c+d;c=c+"</span>";return c}function getCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""}function setCookie(b,c,a){var d=new Date();d.setDate(d.getDate()+a);document.cookie=b+"="+escape(c)+((a==null)?"":";expires="+d.toUTCString())};
