/*****************************************************************************
Copyright (C) 2008  Uğur HAMZADAYI
******************************************************************************/
function getmenuTopPos(obj) 
{
    var curtop = 4;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;	
   return curtop;
};



function getmenuLeftPos(obj) 
{
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
};


function menurefreshcalculatePos(obj) 
{
	if( obj == null )
	   return;
	   
	   /*
  	cxWin = window.innerWidth;
	scrollX = window.pageXOffset;
	if (navigator.appName == "Microsoft Internet Explorer") {
    	cxWin = document.body.clientWidth;
		scrollX = document.documentElement.scrollLeft;
	}

	cyWin = window.innerHeight;
	scrollY = window.pageYOffset;
	if (navigator.appName == "Microsoft Internet Explorer") {
    	cyWin = document.body.clientHeight ;
		scrollY = document.documentElement.scrollTop;
	}
	*/
	cxWin = window.innerWidth;
	scrollX = window.pageXOffset;
	
	if (navigator.appName == "Microsoft Internet Explorer") {
		if( document.documentElement.clientWidth ) {
    	   cxWin = document.documentElement.clientWidth;
		   scrollX = document.documentElement.scrollLeft;
		}
		else {
    	   cxWin = document.body.clientWidth;
		   scrollX = document.body.scrollLeft;
		}
		
	}
	

	cyWin = window.innerHeight;
	scrollY = window.pageYOffset;
	if (navigator.appName == "Microsoft Internet Explorer") {
		if( document.documentElement.clientWidth ) {		
    	   cyWin = document.documentElement.clientHeight;
		   scrollY = document.documentElement.scrollTop;
		}
		else {
    	   cyWin = document.body.clientHeight;
		   scrollY = document.body.scrollTop;
		}
		
	}
	
	
    //Range Belirleniyor...
	rx1 = scrollX;
	ry1 = scrollY;
	rx2 = rx1 + cxWin;
	ry2 = ry1 + cyWin;

	x1Pos = parseInt(obj.style.left );
	y1Pos = parseInt(obj.style.top);
	x2Pos = x1Pos + obj.offsetWidth;
	y2Pos = y1Pos + obj.offsetHeight;
    if( y2Pos > ry2 ) {
		y1Pos -= y2Pos - ry2;
		if( y1Pos < ry1 )
	 	   y1Pos = ry1;
	}
    if( x2Pos > rx2 ) {
		x1Pos -= x2Pos - rx2;
	    if( x1Pos < rx1 )
	 	   x1Pos = rx1;
	}
    obj.style.left = x1Pos +'px'; 
    obj.style.top = y1Pos +'px'; 
	
    frame = document.getElementById(obj.id+'_hideframe');
    if( frame ) {
       frame.style.left = x1Pos + 'px';
	   frame.style.top = y1Pos + 'px';
	   frame.style.width =  obj.offsetWidth + 'px';
	   frame.style.height = obj.offsetHeight +'px';
	   frame.style.display = 'block';
	   obj.style.zIndex = 1000;
	   frame.style.zIndex = 0; 
	}
	
}


function menuchangeOpacity(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 menu_onItemClick( href , target ) {
 
  if( href == "" )
     return;
  if( target == "_CLOSEUSER" ) {
     On_Admin_Close_User_Session();
  }
  else
  if( target == "_LOGINUSER" ) {
	 top.location.href = "std_userjoininline.php";
  }
  else
  if( target == "_USERPROFIL" ) {
	 top.location.href = "std_userprofil.php";
  }
  else
  if( target == "_blank" ) {
	window.open( href , "" , "" );  
  }else
  if ( target == "_popup" ){
     //window.open("ps_mailadd.php","","width=400, height=200, top=100, left=100,scrollbars=no");
	 //alert("Mesaj");
	 if( href.search(/std_userpageview.php/) > 0 || href.search(/std_haberpageview.php/) > 0 ){
	   window.open( href+'&disable_navigator' , "" , "width=800, height=600, top=20, left=40,scrollbars=yes" ); 
	 }else{
	   window.open( href , "" , "width=800, height=600, top=20, left=40,scrollbars=yes" );  
	 }
  }
  else { //Geçerli pencerede açar
	top.location.href = href ;
  }

}


function UMenuInit( template , menuid , verthorz , headerText , iWidthParent , iWidthSub ) {
  
 var filepath = "javascript/menu/menu"+template+"/";	
 menutitle = "";
 var maindiv = document.getElementById(menuid);
 if( maindiv == null )
    return;
	
 menutitle = maindiv.getAttribute('name');
 if( menutitle == ""  )
    menutitle = headerText;
 
 switch( template ) {
	case 1:
	   UMenu_1_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 2:
	   UMenu_2_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 3:
	   UMenu_3_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 4:
	   UMenu_4_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 5:
	   UMenu_5_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 6:
	   UMenu_6_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 7:
	   UMenu_7_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 8:
	   UMenu_8_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 9:
	   UMenu_9_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 10:
	   UMenu_10_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 11:
	   UMenu_11_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 12:
	   UMenu_12_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 13:
	   UMenu_13_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 14:
	   UMenu_14_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 15:
	   UMenu_15_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 16:
	   UMenu_16_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	case 17:
	   UMenu_17_Init( menuid , verthorz , menutitle , iWidthParent , iWidthSub , filepath );   
	break;
	
 }





//inc("jsValidation.js");
//inc("jsEvents.js");


  
  //UMenu_1_Init( menuid , verthorz , headerText , iWidthParent , iWitdhSub )
  //alert( "34" );

}