     /**
     *heightWindow  جلب ارتفاع الصفحة
     * @return int
     */

   var  heightWindow=function(){
	var h=0;
	if(window.inneerWidth){
		h=parseInt(window.inneerHeight);
	}
	else if((document.body) &&(document.body.clientHeight)){
		h=parseInt(document.body.clientHeight);
	}
	else if((document.documentElement) &&(document.documentElement.clientHeight)){
		h=(parseInt(document.documentElement.clientHeight)+(document.documentElement.scrollHeight));
	}
	return h;
};
     /**
     *widthWindow  جلب عرض الصفحة كاملة
     * @return int
     */

    var widthWindow=function(){
	var h=0;
	if(window.inneerWidth){
		h=parseInt(window.inneerWidth);
	}
	else if((document.body) &&(document.body.clientWidth)){
		h=parseInt(document.body.clientWidth);
	}
	else if((document.documentElement) &&(document.documentElement.clientWidth)){
		h=(parseInt(document.documentElement.clientWidth)+(document.documentElement.scrollWidth));
	}
	return h;
};

/**
*changeOpacity تغيير شافية الععنصر
*@return void;
**/

	var changeOpacity=function (opacity, id) {
            var object =(typeof (id=='string'))?document.getElementById(id).style:id.style;
            object.opacity = (opacity / 100);
            object.MozOpacity = (opacity / 100);
            object.KhtmlOpacity = (opacity / 100);
            object.filter = "alpha(opacity=" + opacity + ")";
  };
  
      /**
     * $ function الحصول على مقبض العنصر
     * @param 1 :string
     *	@return 1:handel
     */


  var $=function(){
  	return typeof (arguments[0]=='string')?document.getElementById(arguments[0]):arguments[0];
  };

  
  var conectus=function(){

	 if($('conectus').style.display=='block'){
		$('conectus').style.display='none';
	}
	else {
		$('conectus').style.display='block';
		$('conectus').style.height=heightWindow()+'px';
		$('conectus').style.width=widthWindow()+'px';
		//changeOpacity(90,'conectus');
		BK.Ajax.Updates('html/conectus.php',$('conectus'));

		
	}
	
};

//طرق الدفع
var advancement=function(){
	
	 if($('conectus').style.display=='block'){
		$('conectus').style.display='none';
	}
	else {
		$('conectus').style.display='block';
		$('conectus').style.height=heightWindow()+'px';
		$('conectus').style.width=widthWindow()+'px';
		//changeOpacity(90,'conectus');
		BK.Ajax.Updates('html/advancement.php',$('conectus'));

		
	}
	
};
/**
*التحقق من القيمة
**/
  var vildate=function(){
	var returns =true;	
	for(var k in arguments[1]){
		
		if($(arguments[0])[arguments[1][k]].value=='' ||$(arguments[0])[arguments[1][k]].value==null){
//			$(arguments[0])[arguments[1][k]].className+=' Invalid-Value';
			var bar=$(arguments[0])[arguments[1][k]].parentNode;
			
			if(bar.getElementsByTagName('img')[0]!=undefined){
				bar.removeChild(bar.getElementsByTagName('img')[0]);
			}
			if(bar.getElementsByTagName('img')[0]==undefined){
				
			var img=new Image();
			img.className='err';
			img.title='لقد تركت الحقل فارغ';
			img.src='images/wrong.gif';
			bar.appendChild(img);
			}

			returns =false;
		}
		
		else if($(arguments[0])[arguments[1][k]].value!='' ||$(arguments[0])[arguments[1][k]].value!=null){
//		$(arguments[0])[arguments[1][k]].className=$(arguments[0])[arguments[1][k]].className.replace(/ Invalid-Value/gi,'');

		var bar=$(arguments[0])[arguments[1][k]].parentNode;
			
			if(bar.getElementsByTagName('img')[0]!=undefined){
				bar.removeChild(bar.getElementsByTagName('img')[0]);
			}
			if(bar.getElementsByTagName('img')[0]==undefined){
				
			var img=new Image();
			img.className='ok';
			img.title='';
			img.src='images/correct.gif';
			bar.appendChild(img);
			}
		
		}	
	}
	return returns;
};

var isMail=function(){
	var e=/^\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.(\w{2,3})$/i;
	if(e.test($(arguments[0]).value)){
		BK.Ajax.Updates('adtolist.html?mail='+$(arguments[0]).value,$('resultAdToList'));
	}
	else{
		$('resultAdToList').className+=' Invalid-Value';
		$('resultAdToList').innerHTML='تحقق من  صحة  البريد الالكتروني';
	}
};



    /*
   *موقع الماوس الافقي      
       * @param e event
    */
   var Get_MouseX = function(e) {
        e = e ? e : window.event;
        return e.clientX ? e.clientX : e.x;
    };

    /*
     *موقع الماوس العامودي    
    */
    var Get_MouseY = function(e) {
        e = e ? e : window.event;
        return e.clientY ? e.clientY : e.y;
    };

    /**
     دالة العرض*       
     * @param event
     * @param O_W عرض الكائن او مقدار الازاحة
     * @example  var TOOLTIP=new BK.ToolTip ();alert(TOLLTIP.XPos(event,parseint(id.style.width));
     */
    var XPos = function(event, O_W) {

        O_W = O_W ? O_W : 0;    //مقدار ازاحة العنصر اي عرض الكائن

        var PosX =Get_MouseX(event);  //الموقع الجديدللعنصر الافقي
        var ScrollX = window.scrollX ? window.scrollX : document.documentElement.scrollLeft; //الحصول على السكرول الافقي
        var Client_Width = window.innerWidth ? window.innerWidth : document.body.clientWidth;     //عرض المساحة الحالية للصفحة

        PosX = PosX + ScrollX;//الموقع الجديد الافقي
/*
        if ((PosX + O_W ) > Client_Width) {
            PosX = PosX -O_W;
        }*/

        return PosX-O_W+30;
    }


    /**
     * الحصول على الموقع اعامودي للمؤشر         
     * @param event   الحدث
     * @param O_H      عرض الكائن او مقدار الازاحة للعنصر
     * @example  var TOOLTIP=new BK.ToolTip ();alert(TOLLTIP.YPos(event,parseint(id.style.height));
     */
    var YPos = function(event, O_H) {

        O_H = O_H ? O_H : 0;    //مقدار ازاحة العنصر اي عرض الكائن

        var PosY =Get_MouseY(event);  //الموقع الجديدللعنصر الافقي
        var ScrollY = window.scrollY ? window.scrollY : document.documentElement.scrollTop; //الحصول على السكرول الافقي
        var Client_Height = window.innerHeight ? window.innerHeight : document.body.clientHeight ;     //عرض المساحة الحالية للصفحة

        PosY = PosY + ScrollY;//الموقع الجديد الافقي
/*
        if ((PosY + O_H ) > Client_Height) {
            PosY = PosY - O_H;
        }*/
        return PosY+2;
    }



    
       var MouseButton = function(e) {
        e = e ? e : window.event;
        if(e.button){
        	e.button;
        }
		if(e.which){
        	return e.which;
		}
		else{
			return 0;
		}
    };
    
    /**
    عرض اداة التلميح للعضو المميز
    **/
    
  var Show_Ele=function(event,HWND,userid){
     HWND = (typeof(HWND) == 'string') ? document.getElementById(HWND) : HWND; //مقبض اداة التلميح
	HWND.style.top=YPos (event,parseInt(HWND.style.top))+'px';
   	HWND.style.left=XPos (event,parseInt(HWND.style.width)-10)+'px';
	var casee=(HWND.style.display=='block')?'none':'block';
	BK.Ajax.Updates('ajax_info_user.php?t='+userid,$('ajax_info_user_tooltip'));

	HWND.style.display=casee;
	HWND.onmouseout=function(){
	HWND.style.display='none';
	}
		HWND.onmouseover=function(){
	HWND.style.display='block';
	}	
   };
   
   //////////////////////////////تلميح اخر المزادات وغيها
     var tolltip=function(event,txt){
    var HWND = document.getElementById('bktooltip'); //مقبض اداة التلميح
	HWND.style.top=YPos (event,parseInt(HWND.style.top))+'px';
   	HWND.style.left=XPos (event,parseInt(HWND.style.width)-10)+'px';
	var casee=(HWND.style.display=='block')?'none':'block';
	$('ajax_info_user_tooltip').innerHTML=txt;

	HWND.style.display=casee;
	HWND.onmouseout=function(){
	HWND.style.display='none';
	}
		HWND.onmouseover=function(){
	HWND.style.display='block';
	}	
   };
   ///////////////////////////////////////////
   
      //عرض القائمة الفرعية
  var Show_subMenu=function(event,HWND){
  	document.oncontextmenu=function(){return false;}

  	 event = event ? event : window.event;
  	 if(event.button==2){
    HWND = (typeof(HWND) == 'string') ? document.getElementById(HWND) : HWND; //مقبض اداة التلميح
	HWND.style.top=YPos (event,parseInt(HWND.style.top))+'px';
   	HWND.style.left=XPos (event,parseInt(HWND.style.width))+'px';
	var casee=(HWND.style.display=='block')?'none':'block';
	HWND.style.display=casee;
	HWND.onmouseout=function(){
	HWND.style.display='none';
	}
		HWND.onmouseover=function(){
	HWND.style.display='block';
	}	
  	 }
   };
   
   
   
     var Show_ajax_domin=function(event,HWND,domin){
    HWND = (typeof(HWND) == 'string') ? document.getElementById(HWND) : HWND; //مقبض اداة التلميح
	HWND.style.top=YPos (event,parseInt(HWND.style.top))+'px';
   	HWND.style.left=XPos (event,parseInt(HWND.style.width))+'px';
	var casee=(HWND.style.display=='block')?'none':'block';
	BK.Ajax.Updates('ajax_info_domin.php?t='+domin,$('ajax_info_user_tooltip'));

	HWND.style.display=casee;
	HWND.onmouseout=function(){
	HWND.style.display='none';
	}
		HWND.onmouseover=function(){
	HWND.style.display='block';
	}
	
   }
   ///bk team
   
        var BK_TEM=function(event){
    HWND = $('bktooltip'); //مقبض اداة التلميح
	HWND.style.top=YPos (event,parseInt(HWND.style.top))+'px';
   	HWND.style.left=XPos (event,parseInt(HWND.style.width)-10)+'px';
	var casee=(HWND.style.display=='block')?'none':'block';
	BK.Ajax.Updates('BK-Dwal.biz.html',$('ajax_info_user_tooltip'));

	HWND.style.display=casee;
	HWND.onmouseout=function(){
	HWND.style.display='none';
	}
		HWND.onmouseover=function(){
	HWND.style.display='block';
	}
	
   }


   var  showConectus_img=function(src){
    	$('conectus').style.display='block';
		$('conectus').style.height=heightWindow()+'px';
		$('conectus').style.width=widthWindow()+'px'; 
		$('conectus').innerHTML='<table cellpadding="0" cellspacing="0" style="width: 10px; margin:50% auto auto auto; height: 219px;">'+
	'<tr>'+
		'<td><img alt="" src="images/shdow-corner-top-left.png" /></td>'+
		'<td>'+
		'<table cellpadding="0" cellspacing="0" style="width: 100%">'+
		'<tr>'+
				'<td style="width: 15px; background-image: url(\'images/shdow-bg-top.png\'); background-repeat: repeat-x;">'+
				'</td>'+
				'<td style="width: 10px">'+
				'<img alt="" onclick="$(\'conectus\').style.display=\'none\';" src="images/shdow-close-top-left.png" style="cursor: pointer; height: 25px;" />'+
				'</td>'+
				'<td style="background-image: url(\'images/shdow-bg-top.png\'); background-repeat: repeat-x">'+
				'</td>'+
			'</tr>'+
		'</table>'+
		'</td>'+
		'<td><img alt="" src="images/shdow-corner-top-right.png" /></td>'+
	'</tr>'+
	'<tr>'+
	'	<td style="width: 1px; background-image: url(\'images/shdow-bg-left.png\'); background-repeat: repeat-y;">'+
	'	<img alt="" src="images/shdow-bg-left.png" /></td>'+
	'	<td style="height: 197px; background-color: #000;">'+
	'	<table cellpadding="0" cellspacing="0" style="width: 100%; margin-left: 9px; margin-top: 0px; height: 196px;">'+
	'		<tr>'+
	'			<td>'+
	'			<table id="formConectus" cellpadding="0" cellspacing="0" style="width: 198px; direction: rtl; border-left: 1px solid #94abcb; border-right: 1px solid #94abcb; border-top-style: none; border-top-width: 0px; border-bottom: 1px solid #94abcb; height: 198px; color: #000; margin-right: auto; margin-left: auto; background-color: #fff;">'+
	'				<tr>'+
	'					<td valign="top">'+
	'</td>'+
	'				</tr>'+
	'			</table>'+
	'			</td>'+
	'		</tr>'+
	'	</table>'+ 
	'	</td>'+
	'	<td style="width: 1px; background-image: url(\'images/shdow-bg-right.png\'); background-repeat: repeat-y;">'+
	'	</td>'+
	'</tr>'+
	'<tr>'+
	'<td>'+
	'<img alt="" src="images/shdow-corner-down-left.png" />'+
	'</td>'+
	'<td style="background-image: url(\'images/shdow-bg-doen.png\'); background-repeat: repeat-x">'+
	'<img alt="" src="images/shdow-bg-doen.png" style="width: 8px" /></td>'+
	'<td><img alt="" src="images/shdow-corner-dwnl-right.png" /></td>'+
	'</tr>'+
'</table>';


		
		 
		//changeOpacity(90,'conectus');
		var img=document.createElement('img');
			img.src=src;
		$('formConectus').appendChild(img);
		img.onmouseover=function(){
		
			//changeOpacity(100,'formConectus');
		};
    }
