﻿var logicalPath="http://sports.maktoob.com/";var strSearchPage="Internal.aspx?pagename=search&Key=[KEYWORD]&SearchType=[TYPE]";var strMediaSearchPage="Internal.aspx?pagename=Media_Search&keyword=[KEYWORD]&MediaType=[TYPE]&PNO=1";var strPlayerSearchPage="Internal.aspx?pagename=Player_Search&keyword=[KEYWORD]&MediaType=[TYPE]&PNO=1";var strTeamSearchPage="Internal.aspx?pagename=Team_Search&keyword=[KEYWORD]&MediaType=[TYPE]&PNO=1";var siteTitle="كورة و أكثر في مكتوب الرياضي";var PagesTillFeedBackForm=4;function GetXmlHttp(){var xmlhttp=false;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else if(window.ActiveXObject){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}}return xmlhttp;}
function AJAXGet(url,callback,method,params){var xmlhttp=new GetXmlHttp();if(xmlhttp){xmlhttp.onreadystatechange=function(){if(xmlhttp&&xmlhttp.readyState==4){if(xmlhttp.status==200){callback(xmlhttp.responseText);}}};if(String(method).toLowerCase=='post'){xmlhttp.open('POST',url,true);var xstr=String(params);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",xstr.length);xmlhttp.setRequestHeader("Connection","close");xmlhttp.send(xstr);}else{xmlhttp.open('GET',url,true);xmlhttp.send(null);}}}
function commentDeleted(res){if(res.trim()!=""){alert(res);}}
function deleteComment(commentID,obj,type){if(!confirm("هل انت متأكد من ان هذا التعليق يحتوي على الفاظ مسئية؟")){return false;}var i=obj.parentNode.parentNode.parentNode.rowIndex;$$("tblComments").deleteRow(parseInt(i,10)-1);$$("tblComments").deleteRow(parseInt(i,10)-1);$$("tblComments").deleteRow(parseInt(i,10)-1);var strSubmit="ASPX_Pages/Ajaxhandler.aspx?Flag=delComments&cid="+commentID+"&type="+type;AJAXGet(strSubmit+"&rnd="+parseInt(Math.random()*100,10),commentDeleted,"post");}
function Refresh_Page(){self.location.href=(self.location.href+'#').split("#")[0];}
function setCookie(c_name,value,expiredays){var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+";"+((expiredays===null)?"":";expires="+exdate.toGMTString());}
function selectCountry(ddlCountry){setCookie("SportTime",ddlCountry.value+"_"+ddlCountry.selectedIndex,360);Refresh_Page();}
function getkey(e){if(window.event){return window.event.keyCode;}else{if(e){return e.which;}else{return null;}}}
function HitKeyOnKeyPress(e,objbtnId){var gobtn=$$(objbtnId);var key=getkey(e);if(key==13){gobtn.click();return false;}}
function ValidateEmail(ID,Msgs){var EmailString=$$(ID).value;var EmailFormat=new RegExp(/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/);if(EmailFormat.exec(EmailString)===null){$$(ID).focus();alert(Msgs);return false;}return true;}
function isValidCount(txtID){if(SpnsCharCountIDs.indexOf("["+txtID+"]")==-1){return true;}return false;}
function cleanInjection(txtID){var re=new RegExp("[/\!\@\#$\%\^\&\*_+\}\|\(\)\{:\?\<\>\'\"]","g");$$(txtID).value=$$(txtID).value.replace(re,"");}
function show(menuDiv){$$(menuDiv).style.display="block";$$("frm"+menuDiv).style.display="block";}
function hide(menuDiv){$$(menuDiv).style.display="none";$$("frm"+menuDiv).style.display="none";}
function isValidLongText(txtID){var strComment=String($$(txtID).value);if(strComment.split(" ").length==1){if(strComment.length<55){return true;}return false;}for(var i=0;i<strComment.split(" ").length;i++){if(strComment.split(" ")[i].length>40){return false;}}return true;}
function validateInput(IDs,Msgs){var strIDs=String(IDs);var strMsgs=String(Msgs);for(var i=0;i<strIDs.split(",").length;i++){var strCurrentID=strIDs.split(",")[i];var strCurrentMsg=strMsgs.split(",")[i];var isValid=true;switch($$(strCurrentID).tagName.toLowerCase()){case"select":if($$(strCurrentID).value==-1){isValid=false;}break;case"input":case"textarea":if(strCurrentID.toLowerCase().indexOf("email")>-1){if(!ValidateEmail(strCurrentID,strCurrentMsg)){return false;}}else{cleanInjection(strCurrentID);}if($$(strCurrentID).type.toLowerCase()!="file"){if(!isValidLongText(strCurrentID)){alert("بعض الكلمات تحتوي على أحرف أكثر من المسموح");$$(strCurrentID).select();return false;}}if($$(strCurrentID).value==""){isValid=false;}if($$(strCurrentID).type.toLowerCase()!="file"){if(!isValidCount(strCurrentID)){alert("عدد الأحرف المستخدمة أكثر من المسموح");$$(strCurrentID).select();return false;}}break;}if(!isValid){alert(strCurrentMsg);$$(strCurrentID).focus();return false;}}return true;}
function validatecommentsinput(IDs, Msgs){var strIDs = String(IDs);var strMsgs = String(Msgs);for (var i = 0; i < strIDs.split(",").length; i++) { var strCurrentID = strIDs.split(",")[i]; var strCurrentMsg = strMsgs.split(",")[i]; cleanInjection(strCurrentID);var isValid = true;switch ($$(strCurrentID).tagName.toLowerCase()){case "select":
if ($$(strCurrentID).value == -1) {isValid = false;}break;case "input":case "textarea":if (strCurrentID.toLowerCase().indexOf("email") > -1) {if (!ValidateEmail(strCurrentID, strCurrentMsg)) {return false;}}
if ($$(strCurrentID).type.toLowerCase() != "file") {if (!isValidLongText(strCurrentID)) {alert("بعض الكلمات تحتوي على أحرف أكثر من المسموح");$$(strCurrentID).select();return false;}}if ($$(strCurrentID).value.trim() == "") {isValid = false;}if ($$(strCurrentID).type.toLowerCase() != "file") {if (!isValidCount(strCurrentID)) {alert("عدد الأحرف المستخدمة أكثر من المسموح");$$(strCurrentID).select();return false;}}break;}if (!isValid) {alert(strCurrentMsg);$$(strCurrentID).focus();return false;}}return true;}
var SearchType="3";function SwitchSearch(SeachValue){SearchType=SeachValue;}
function goSearch(txtID){cleanInjection(txtID);if(!validateInput(txtID,'الرجاء إدخال نص للبحث')){return false;}switch(SearchType){case"3":self.location=strSearchPage.replace("[KEYWORD]",escape($$(txtID).value)).replace("[TYPE]","site");break;case"4":self.location=strSearchPage.replace("[KEYWORD]",escape($$(txtID).value)).replace("[TYPE]","web");break;case"1":self.location=strMediaSearchPage.replace("[KEYWORD]",escape($$(txtID).value)).replace("[TYPE]","zoom");break;case"2":self.location=strMediaSearchPage.replace("[KEYWORD]",escape($$(txtID).value)).replace("[TYPE]","clip");break;case"5":self.location=strPlayerSearchPage.replace("[KEYWORD]",escape($$(txtID).value)).replace("[TYPE]","player");break;case"6":self.location=strTeamSearchPage.replace("[KEYWORD]",escape($$(txtID).value)).replace("[TYPE]","team");break;}return false;}
var beforeScroll;var moveDownVarTimer;function stopscroll(){clearTimeout(moveDownVarTimer);}
function scrollStep(contentID,ContainerID,Direction,pixScroll){if(!moveDownVarTimer){beforeScroll=$$(ContainerID).scrollLeft;}clearTimeout(moveDownVarTimer);switch(Direction){case"Right":if(is_ie){if($$(ContainerID).scrollLeft>beforeScroll-pixScroll&&((beforeScroll-pixScroll)!=(-1*pixScroll))){$$(ContainerID).scrollLeft-=8;moveDownVarTimer=setTimeout("scrollStep('"+contentID+"','"+ContainerID+"','"+Direction+"',"+pixScroll+");",1);}else{stopscroll();moveDownVarTimer=null;}}else{if($$(ContainerID).scrollLeft>beforeScroll-pixScroll&&((beforeScroll-pixScroll)==(-1*pixScroll))){$$(ContainerID).scrollLeft-=8;moveDownVarTimer=setTimeout("scrollStep('"+contentID+"','"+ContainerID+"','"+Direction+"',"+pixScroll+");",1);}else{stopscroll();moveDownVarTimer=null;}}break;case"Left":if($$(ContainerID).scrollLeft<beforeScroll+pixScroll){$$(ContainerID).scrollLeft+=8;moveDownVarTimer=setTimeout("scrollStep('"+contentID+"','"+ContainerID+"','"+Direction+"',"+pixScroll+");",1);}else{stopscroll();moveDownVarTimer=null;}break;}return false;}
function scrolling(contentID,ContainerID,Direction){switch(Direction){case"Right":if($$(ContainerID).scrollLeft>0){clearTimeout(moveDownVarTimer);$$(ContainerID).scrollLeft-=3;}else{return false;}break;case"Left":if($$(contentID).offsetWidth>$$(ContainerID).scrollLeft-$$(ContainerID).offsetWidth){clearTimeout(moveDownVarTimer);$$(ContainerID).scrollLeft+=3;}else{return false;}break;}moveDownVarTimer=setTimeout("scrolling('"+contentID+"','"+ContainerID+"','"+Direction+"');",10);}
function SwitchBtn(contentID,ContainerID,Direction,pixScroll,btnLeft,btnRight){if($$(btnLeft)&&$$(btnRight)){if($$(btnLeft).className=="arL"&&Direction=="Left"){scrollStep(contentID,ContainerID,Direction,pixScroll);$$(btnLeft).className="arLdis";$$(btnRight).className="arR";}else if($$(btnRight).className=="arR"&&Direction=="Right"){scrollStep(contentID,ContainerID,Direction,pixScroll);$$(btnLeft).className="arL";$$(btnRight).className="arRdis";}}}
var txt_size=13;function fontUp(){if(txt_size<16){var divObj=$$("divText");divObj.style.fontSize=++txt_size+"px";}}
function fontDown(){if(txt_size>9){var divObj=$$("divText");divObj.style.fontSize=--txt_size+"px";}}
function AddComment(){var Anchor="#AddComment";var LogInAnchor="#LogInAnch";var LatestComment="#LatestComment";var CurrentLocation=self.location.href;if(self.location.href.indexOf(LogInAnchor)>-1){CurrentLocation=self.location.href.split('#')[0];}if(CurrentLocation.indexOf(LatestComment)>-1){CurrentLocation=self.location.href.split('#')[0];}if(CurrentLocation.indexOf(Anchor)>-1){self.location.href=CurrentLocation;}else{self.location.href=CurrentLocation+Anchor;}try{if($$(txtClientID)!==null){$$(txtClientID).focus();}}catch(e){}return false;}
function LogInAnchor(){var Anchor="#LogInAnch";var CommentAnchor="#AddComment";var LatestComment="#LatestComment";var CurrentLocation=self.location.href;if(self.location.href.indexOf(CommentAnchor)>-1){CurrentLocation=self.location.href.split('#')[0];}if(CurrentLocation.indexOf(LatestComment)>-1){CurrentLocation=self.location.href.split('#')[0];}if(CurrentLocation.indexOf(Anchor)>-1){self.location.href=CurrentLocation;}else{self.location.href=CurrentLocation+Anchor;}}
function tabChange(prefix,maxnum,active,classname){for(var i=1;i<=maxnum;i++){if($$(prefix+i)){$$(prefix+i).className="";}}if($$(prefix+active)){$$(prefix+active).className=(classname==undefined||classname==null?"on":classname);}}
function tabs_global(tabPrefix,imgPrefix,contentPrefix,maxnum,active,activeclassname){tabChange(tabPrefix,maxnum,active,activeclassname);for(var i=1;i<=maxnum;i++){var strImgPrefix=imgPrefix+i.toString();var strContentPrefix=contentPrefix+i.toString();if(imgPrefix!=""){$$(strImgPrefix).style.display="none";}if($$(strContentPrefix)){$$(strContentPrefix).style.display="none";}}var strContentPrefix1=contentPrefix+active.toString();if($$(strContentPrefix1)){$$(strContentPrefix1).style.display="block";}return false;}
function NavigateTo(PageName,IDs){var strPath=PageName+"-";for(var i=0;i<IDs.split(",").length;i++){var strID=IDs.split(",")[i];if(i<IDs.split(",").length-1){if($$(strID)){strPath=strPath+$$(strID).value+"-";}else{strPath=strPath+strID+"-";}}else{if($$(strID)){strPath=strPath+$$(strID).value+".htm";}else{strPath=strPath+strID+".htm";}}}self.location.href=strPath;return false;}
function SwitchToOtherSection(){if($$(SectiondDDLClientID)!==null){var SectionName=$$(SectiondDDLClientID).value.split(',')[2];var re=new RegExp($$(hdnValidateExp).value,"g");SectionName=SectionName.replace(re,"_");var SectionID=$$(SectiondDDLClientID).value.split(',')[0];var SectionType=$$(SectiondDDLClientID).value.split(',')[1];var NewNavigationIDs=SectionID+","+SectionName+","+SectionType;NavigateTo(LogicalRoot+'League',NewNavigationIDs);}return false;}
function SwitchToOtherPlayer(){if($$(PlayerDDLClientID)!==null){var PlayerName=$$(PlayerDDLClientID).value.split(',')[0];var re=new RegExp($$(hdnValidateExp).value,"g");PlayerName=PlayerName.replace(re,"_");var PlayerID=$$(PlayerDDLClientID).value.split(',')[1];var SectionID=$$(PlayerDDLClientID).value.split(',')[2];var NewNavigationIDs=PlayerID+","+PlayerName+","+SectionID;NavigateTo(LogicalRoot+'player',NewNavigationIDs);}return false;}
function ClearText(TbControl,defaultTxt){if(TbControl.value==defaultTxt){TbControl.value="";}}
function GoToReg(PageName,TbEmail){if($$(TbEmail)&&ValidateEmail(TbEmail,'الرجاء ادخال بريد الالكتروني بشكل صحيح')){var strPath=PageName+"-";strPath=strPath+escape($$(TbEmail).value.replace(".","~"))+".htm";self.location.href=strPath;}return false;}
function CreatedFavoriteLink(){title=siteTitle;url=logicalPath;if(window.sidebar){window.sidebar.addPanel(title,url,"");}else if(window.external){window.external.AddFavorite(url,title);}else if(window.opera&&window.print){return true;}}
function GetDropDownValue(ddlID,txtID){$$(txtID).value=$$(ddlID).value;}
var leftBtnInterval=-1;function arLeftDis(){if($$('tdLeft')!==null){$$('tdLeft').className='arLdis';clearInterval(leftBtnInterval);}}
var RightBtnInterval=-1;function arRightDis(){if($$('tdRight')!==null){$$('tdRight').className='arRdis';}}
function SwitchToOtherTeam(){if($$(ddlTeamsClientID)!==null){if($$(ddlTeamsClientID).value=="-99"){alert("الرجاء إختيار فريق");return false;}self.location.href=$$(ddlTeamsClientID).value;}return false;}
function SwitchToOtherRound(){if($$(ddlRoundValue)!==null){self.location.href=$$(ddlRoundValue).value;}}
function selectUserTheme(ddlObj){setCookie("UserTheme",ddlObj.value,360);Refresh_Page();return false;}
function initSpan(spnID){if($$(spnID).innerHTML==""){$$(spnID).value="0";}$$(spnID).style.color="#005500";$$(spnID).style.fontWeight="bold";}
function countIt(spnID,txtID,MaxAlloweded,e){initSpan(spnID);e=e?e:window.event;var txtToSearch=$$(txtID).value.trim();if(txtToSearch.length>MaxAlloweded){$$(spnID).style.color="#cc0000";if(SpnsCharCountIDs.indexOf("["+txtID+"]")<0){SpnsCharCountIDs=SpnsCharCountIDs+"["+txtID+"]";}}if(txtToSearch.length<=MaxAlloweded){$$(spnID).style.color="#005500";SpnsCharCountIDs=SpnsCharCountIDs.replace("["+txtID+"]","");}$$(spnID).innerHTML=txtToSearch.length;}
function GetQValue(QID){for(var i=1;i<4;i++){var rID="Q"+QID+"A"+i;if($$(rID)!==null){if($$(rID).checked){return $$(rID).value;}}}return null;}
function callBackFromAjaxValidateLogin(param){var str1=param.substring(param.indexOf("<div id=\"divParent\">"),param.length);var str2=str1.substring(20,str1.indexOf("</div>"));if(str2!=""){}else{if($$("lnkMyProfile")!==null){$$("lnkMyProfile").style.display="none";}}$$("DivLogin").style.display="block";}
function afterlogout(res){}
function FillUserProfileLink(param){if(param!=""){if(param.indexOf("IFrameLoginRenew")>-1){$$("IfrmLogin").src="http://login.maktoob.com/index.php/renew/sports/aHR0cDovL3Nwb3J0My5tYWt0b29iLmNvbS9kdW0uaHRtbA==/ar/";}if(param.indexOf("IFrameLoginLogout")>-1){AJAXGet("http://login.maktoob.com/index.php/logout/sports/aHR0cDovL3Nwb3J0My5tYWt0b29iLmNvbS9kdW0uaHRtbA==/ar/",afterlogout,"get");}var str1=param.substring(param.indexOf("<div id=\"divParent\">"),param.length);var str2=str1.substring(20,str1.indexOf("</div>"));if($$('UserInfo')!==null&&str2!=""){$$('UserInfo').innerHTML=str2;}}}
function CallAjaxPageValidateLogin(){var randomNumber=Math.random()*11;AJAXGet("ASPX_Pages/AjaxHandler.aspx?&random="+randomNumber+"&Flag=1",callBackFromAjaxValidateLogin,"get");randomNumber=Math.random()*11;AJAXGet("ASPX_Pages/AjaxHandler.aspx?&random="+randomNumber+"&Flag=3",FillUserProfileLink,"get");}
function fillVoteDiv(param){$$("divVoting").innerHTML=param;}
function AjaxLoading(divID){$$(divID).innerHTML="الرجاء الإنتظار ... ";}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/,'');};function LoadVoteForm(sec_id,divId){AjaxLoading(divId);var sDestinationURL="ASPX_Pages/VotingResults.aspx?SecID="+sec_id;AJAXGet(sDestinationURL,fillVoteDiv,"get");}
function doVote(ListID,num,divId,sec_id,QiD){var answer_id=0;for(var i=0;i<=parseInt(num,10);i++){if($$(ListID+"_"+i).checked){answer_id=$$(ListID+"_"+i).value;}}var sDestinationURL="ASPX_Pages/VotingResults.aspx?ViewVoteResults=true&SecID="+sec_id+"&answer_id="+answer_id+"&QiD="+QiD;AJAXGet(sDestinationURL,fillVoteDiv,"get");}
function correctPNG(){var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);if((version>=5.5)&&(document.body.filters)){for(var i=0;i<document.images.length;i++){var img=document.images[i];var imgName=img.src.toUpperCase();if(imgName.substring(imgName.length-3,imgName.length)=="PNG"){var imgID=(img.id)?"id='"+img.id+"' ":"";var imgClass=(img.className)?"class='"+img.className+"' ":"";var imgTitle=(img.title)?"title='"+img.title+"' ":"title='"+img.alt+"' ";var imgStyle="display:inline-block;"+img.style.cssText;if(img.align=="left"){imgStyle="float:left;"+imgStyle;}if(img.align=="right"){imgStyle="float:right;"+imgStyle;}if(img.parentElement.href){imgStyle="cursor:hand;"+imgStyle;}var strNewHTML="<span "+imgID+imgClass+imgTitle+" style=\""+"width:"+img.width+"px; height:"+img.height+"px;"+imgStyle+";"+"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src=\'"+img.src+"\', sizingMethod='scale');\"></span>";img.outerHTML=strNewHTML;i=i-1;}}}}if(window.attachEvent){window.attachEvent("onload",correctPNG);}
function ShowHideFeedDiv(FeedDivID){if($$(FeedDivID).style.display=="none"){$$(FeedDivID).style.display="block";$$(FeedDivID).style.width=document.getElementsByTagName('body')[0].clientWidth;$$(FeedDivID).style.height=document.getElementsByTagName('body')[0].clientHeight;}else{$$(FeedDivID).style.display="none";}}
var SpnsCharCountIDs=String("");
