function $$( Element ) { if ( document.getElementById( Element ) ) { return document.getElementById( Element ); } else { return false; } } function $$$( Element ) { if( document.getElementsByName( Element ) ) { var sasannobakht = document.getElementsByName( Element ); return sasannobakht[0]; } else { return false; } } function Hide( Element ) { if ( $$( Element ) ) { $( '#'+Element ).hide(); } else { return false; } } function Show( Element ) { if ( $$( Element ) ) { $( '#'+Element ).show(); } else { return false; } } function Change_Display( Element ) { if ( $$( Element ) ) { if ( $$( Element ).style.display == 'none' ) { Show( Element ); } else { Hide( Element ); } } else { return false; } } function Go_Url( Url , Time) { setTimeout('document.location.href="'+Url+'"',Time); } function Get_Value( Element ) { if( !$$( Element ) && !$$( Element+'1' ) ) { return 'No Object'; } else if( $$( Element ).type == 'checkbox' ) { return $$( Element ).checked; } else if( $$( Element ).type == 'radio' || $$( Element+'1' ).type == 'radio') { for( var i = 1; i <= Element.length; i++ ) { var nowid = ''+Element+''+i+''; if( $$(nowid).checked ) { return $$(nowid).value; } } return ''; } else { return $$( Element ).value; } } function Change_Title( Title ) { document.title = Title; } function Change_Class( Element , NewClass ) { if ( $$( Element ) ) { $( '#'+Element ).attr('class', NewClass); } else { return false; } } function Change_Opacity( Element , NewAlpha ) { if ( $$( Element ) ) { $( '#'+Element ).css("filter", "alpha(opacity="+NewAlpha+"%"); $( '#'+Element ).css("opacity", NewAlpha/100); } else { return false; } } function Change_Src( Element , NewSrc ) { if ( $$( Element ) ) { $( '#'+Element ).attr('src', NewSrc); } else { return false; } } function Element_Disable( Element ) { if ( $$( Element ) ) { $( '#'+Element ).attr('disabled', true); } else { return false; } } function Element_Enable( Element ) { if ( $$( Element ) ) { $( '#'+Element ).attr('disabled', ''); } else { return false; } } function Change_Disable( Element ) { if ( $$( Element ) ) { if ( $$( Element ).disabled ) { Element_Disable( Element ); } else { Element_Enable( Element ); } } else { return false; } } function Write( Element , Note ) { if ( $$( Element ) ) { Show( Element ); $( '#'+Element ).html(Note); } else { return false; } } function GetScript(str) { let_out=str; str=str.split('#endofmyscript'); if(str[1] !=null) { DoEval(str[0]); let_out =let_out.replace(str[0]+'#endofmyscript', ''); } return let_out; } function FindScript(str) { let_out = str; jstr = let_out.split(''); if( newstr[1] != null ) { setTimeout("DoEval( newstr[0] )" , 1 ); } } return let_out; } function DoEval(js) { if(js!=null) { var sc = document.createElement('script'); jsCode = js; sc.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(sc); sc.text = 'try{eval(jsCode);}catch(e){}jsCode="";'; sc.text = "\/\/ Programmer : Sasan Nobakht :-)\n\/\/ Mobile : +989153128966 :D"; } } AjaxError = false; function Ajax( Metod , Page , Data , Result_Id , Loading , Type , LoadingPicture , LoadingText , Wait_Id , Javascript , TopPadding ) { if (Metod == "POST") Data = 'Programmer=Sasan Nobakht&Load=Ajax&'+Data+''; $.ajax({ type: Metod, url: Page, data: Data , encoding: 'UTF-8', beforeSend : function( msg ) { if ( Loading ) { Ajax_Loading( Metod , Page , Data , Result_Id , Loading , Type , LoadingPicture , LoadingText , Wait_Id , Javascript , true , TopPadding ) } }, success : function( msg ) { if ( Loading ) { Ajax_Loading( Metod , Page , Data , Result_Id , Loading , Type , LoadingPicture , LoadingText , Wait_Id , Javascript , false , TopPadding ) } if ( Type != 'NoResultShow' && Type != 'Input' ) { $('#'+Result_Id).show(); msg = GetScript(msg); $('#'+Result_Id).html(msg); } else if ( Type == 'Input' ) { msg = GetScript(msg); $$(Result_Id).value = msg; } if ( Javascript !== '' ) { var sasan_all_java = Javascript.split( ';' ) for ( i = 0; i < sasan_all_java.length; i++ ) { setTimeout("eval("+sasan_all_java[i]+")",1); } } AjaxError = false; }, error : function( msg ) { AjaxError = true; } }); } function Ajax_Loading( Metod , Page , Data , Result_Id , Loading , Type , LoadingPicture , LoadingText , Wait_Id , Javascript , Mode , TopPadding ) { if ( Mode ) { if (Type == 'Text') { Write(Wait_Id,LoadingText); } else if (Type == 'Picture') { Write(Wait_Id,""+LoadingText+""); } } else { Write(Wait_Id,''); } } function EvalScript_Url ( url ) { $.getScript(url, function() {}); } var Site = "http://localhost/"; function SetLoc( Page ) { Page = Page.replace( Site , "" ); var cpath = location.pathname.split("/"); var bc = ''; cpath = cpath.length-1; if( location.pathname.lastIndexOf('.') ) { cpath--; } if( cpath ) { do { cpath--; bc += '../'; } while( cpath ) } return bc + Page; } function ForceAjax() { var A = document.getElementsByTagName('A'); for ( var i = 0; i < A.length ; i++ ) { if( A[i].className == "AjaxLink" ) { A[i].onclick = function() { OnclickGo(this); //return false; } } } } function Get_Cookie( check_name ) { var a_all_cookies = document.cookie.split( ';' ); var a_temp_cookie = ''; var cookie_name = ''; var cookie_value = ''; var b_cookie_found = false; for ( i = 0; i < a_all_cookies.length; i++ ) { a_temp_cookie = a_all_cookies[i].split( '=' ); cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); if ( cookie_name == check_name ) { b_cookie_found = true; if ( a_temp_cookie.length > 1 ) { cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') ); } return cookie_value; break; } a_temp_cookie = null; cookie_name = ''; } if ( !b_cookie_found ) { return null; } } function Set_Cookie( name, value, expires, path, domain, secure ) { var today = new Date(); today.setTime( today.getTime() ); if ( expires ) { expires = expires * 60 * 60 * 24; } var expires_date = new Date( today.getTime() + (expires) ); document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } function Delete_Cookie( name, path, domain ) { if ( Get_Cookie( name ) ) document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) +";expires=Thu, 01-Jan-1970 00:00:01 GMT"; } function PopUp(page,code,width,height) { window.open(page,code,'status=no,scrollbars=yes,toolbar=no,menubar=no,location=no,width='+width+',height='+height+''); } function FixPNG(a) { if(navigator.userAgent.indexOf('MSIE')){ var Reg=new RegExp('\\.gif$'); if(!Reg.test(a.src)){ a.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'"+a.src+"\',sizingMethod=\'scale\')"; a.src="Images/PngFix.gif"; } } }