//////////////////////////////////////////include all computing and "primitive" functions\\\\\\\\\\\\\\\\\\\\\
IncludeJavaScript('GuruTools_engine.js');
function IncludeJavaScript(js)
{ 
  document.write('<script type="text/javascript" src="'+ js + '"></script>'); 
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////class\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
function Class(){ 
  return function(args){ 
    if ( this instanceof arguments.callee ) {
      if ( typeof this.construct == "function" )
	     if(args.callee)
              this.construct.apply( this, args);
	     else 	
		      this.construct.apply( this, arguments);
    }
	else
	{ 	
        return  new arguments.callee( arguments );           
	}
  }
};  
var BricksGuru=new Class();
var Element=new Class();
var Positions=new Class();
var DomCompute=new Class();
var Iteration=new Class();
var Observer=new Class();
var BackBone=new Class();
////////////////////////////////////////////////end class\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

///////////////////////////////////////////////class constructors and prototypes\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

/////////////////////////////////////////////////////////Backbone - ajax- operations \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
BackBone.prototype.construct=function(url_way,tip,idu)
{   
	this.url=url_way;
	this.type=tip;
	this.id=idu;
	this.xmlHttp='';
	this.result=-1;
	}
BackBone.prototype.connect=function(){
	
    
  try
    {    // Firefox, Opera 8.0+, Safari
	 this.xmlHttp=new XMLHttpRequest();   
		 }
  catch (e)
    {    // Internet Explorer
	  try
        {      
		this.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      }
      catch (e)
          {
         try
            {        
			this.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        }
           catch (e)
                   { 
	         alert("Your browser does not support AJAX!");  
			         return false;  
					       }  
						       } 
							      }
	   this.result=null;						  
       this.xmlHttp.onreadystatechange=this.computeResult;
      
	   this.xmlHttp.open("GET",this.url,true);
       this.xmlHttp.send(null);	
	   
       
	}
BackBone.prototype.computeResult=function()
{
     if($ajax.xmlHttp.readyState==4)
       {
      if($ajax.xmlHttp.status == 200) {	  
	     if($ajax.type=="populate")
		   { 
		     if(getIt($ajax.id).nodeName=="INPUT")
			 {
			   getIt($ajax.id).value=$ajax.xmlHttp.responseText; 
			 }
			 else if(getIt($ajax.id).nodeName=="SELECT")
			  {
			
				  }
			 else{ 
			   getIt($ajax.id).innerHTML=$ajax.xmlHttp.responseText;
			 }
			 }
	   else if($ajax.type=="return")
		  {    
			 $ajax.result=$ajax.xmlHttp.responseText;  	
			 
			 }	
	   }
	   else { 
	    alert('\n\nThere was a problem with the request.\n\nStatus code: '+$ajax.status+'\n'+$ajax.statusText); } 
     }
	   
	} 
/////////////////////////////////////////////////////////////end \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

////////////////////////////////////////////////////////OBSERVER METHODS\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\c
Observer.prototype.construct=function(){
	this.active_observers=[]; 
	this.element_handlers=[];
}
Observer.prototype.stopPropagation= function(event){ 
    if (!event) var event = window.event; 
    if (event){ 
        event.cancelBubble = true; 
        if (event.stopPropagation) event.stopPropagation(); 
    } 
} 
Observer.prototype.activate=function(meth,object,priority,time,func){ 
	if(contains(this.active_observers,meth+object) && priority!="absolute") return false;
	switch(meth)
	{
		
	    case "onmouseover":        this.active_observers[this.active_observers.length]=meth+object;  
		                          eval(object).onmouseover=eval(func);
						          break;
		case "kill_onmouseover":     compactare(this.active_observers,getIndex(this.active_observers,"onmouseover"+object),"out");	
									eval(object).onmouseover=null;
					         		break;	
	    case "onmousedown":        this.active_observers[this.active_observers.length]=meth+object; 
		                          eval(object).onmousedown=eval(func);
						          break;
		case "kill_onmousedown":   compactare(this.active_observers,getIndex(this.active_observers,"onmousedown"+object),"out");	
									eval(object).onmousedown=null;
					         		break;						  
		case "onmousemove":      this.active_observers[this.active_observers.length]=meth+object; 
		                          eval(object).onmousemove=eval(func); 
							     break;						  
		case "kill_onmousemove": compactare(this.active_observers,getIndex(this.active_observers,"onmousemove"+object),"out");
		                         eval(object).onmousemove=null; 
								 break;
		case "onmouseup":          this.active_observers[this.active_observers.length]=meth+object;  
		                          eval(object).onmouseup = eval(func); 
								  break;
		case "kill_onmouseup":     compactare(this.active_observers,getIndex(this.active_observers,"onmouseup"+object),"out");
								  eval(object).onmouseup  =null; 
							      break;
		case "IE_drag_start":     this.active_observers[this.active_observers.length]=meth+object; 
		                          document.ondragstart = function() {return false;}
		                          break;
		case "kill_IE_drag":       compactare(this.active_observers,getIndex(this.active_observers,"IE_drag_start"+"document"),"out");
        		                   document.ondragstart =null;
		                           break;
		case "interval":              this.active_observers[this.active_observers.length]=meth+object; 
		                           hash("set","interval"+object,setInterval(object,time));	
					                break;
		case "kill_interval":     compactare(this.active_observers,getIndex(this.active_observers,"interval"+object),"out");  
		                          clearInterval(hash("get","interval"+object));
		                            break;
		case "kill_select_start":    this.active_observers[this.active_observers.length]=meth+object;
		                            eval(object).onselectstart =eval(func);	
		                            break;
		case "select_start_on": 
		                           compactare(this.active_observers,getIndex(this.active_observers,"kill_select_start"+object),"out");
		                           eval(object).onselectstart =eval(func);	
		                           break;
		}
	
	}
Observer.prototype.growTree=function(node, num)
{
	 if (node.nodeType == Node.ELEMENT_NODE)  
      d1.write('<li><b><large>&lt;'+node.nodeName+'&gt;</large></b>');  
     else  
      d1.write('<li><b><large>'+node.nodeName+'</large></b>');  
     if (node.nodeType != Node.TEXT_NODE && node.nodeType != Node.ELEMENT_NODE)  
      d1.write(' <i>('+node_types[node.nodeType].toLowerCase().replace(/ node$/,'')+')</i> ');  
     if (node.attributes && node.attributes.length) {  
     d1.write('<ol type="A"> ')  
     for (var i=0;i<node.attributes.length; ++i)  
         this.growTree(node.attributes.item(i),i);  
     d1.write('</ol>')  
     }  
     if (node.childNodes && node.childNodes.length) {  
     d1.write('<ol>')  
     for (var i=0;i<node.childNodes.length;++i)  
         this.growTree(node.childNodes.item(i), i);  
     d1.write('</ol>')  
     }  
     d1.write("</li>\n");  
	}
Observer.prototype.debug=function(type,element)
{
	if(type=="document_tree")
	 {
	  var w1=window.open('', 'TREE');  
      d1=w1.document;  
      d1.open();  
      d1.writeln('<h1>Document tree</h1>\n<ol>');  
      this.growTree(document,'',1);  
      d1.writeln('</ol>');  
      d1.close(); 
		 }
	else if(type=="dump")
	 {
		 
		 }
	}	
/////////////////////////////////////////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//////////////////////////////////////////////||Iteration methods||\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Iteration.prototype.construnc=function()///////////////////////custom iteration with or without exeception throwing\\\\\\\\\\\\\\\\\\
{
	this.$index=0;
	this.StopIteration = function () {};
    this.StopIteration.prototype = new Error();
    this.StopIteration.name = 'StopIteration';
    this.StopIteration.message = 'StopIteration';
	}
Iteration.prototype.arrayWalk=function (array,start_index,tail) { ///// walking an array with prev and next\\\\\\\\\\\\\\\\
    var i = start_index;
	if(tail==null) tail=0;
    return {
        'next': function (increment) {
		 if(increment==null) increment=1; 
            if (i >= array.length) {
			  if(tail==0)
                throw StopIteration;
			  else i=0;
			   
            }
		    i=i+increment;
            return array[i-1];
        },
		 'prev': function (increment) {
			if(increment==null) increment=1;	 
            if (i < 0) {
            if(tail==0)
                throw StopIteration;
			 else i=array.length;
            }
			i=i-increment;
            return array[i+1];
        }
		 
    }
}

Iteration.prototype.stack=function (array,method) { ///// stack like -fifo - lifo  principel \\\\\\\\\\\\\\\\
var i = 0;
if(method==null) method="fifo";
 return {
        'pop': function () {
            if (array.length==0) {
                throw StopIteration;
            }
			if(method=="fifo")
			 {
			 var poped=array[0];
			 array=compactare(array,array.length-1,"out"); 
              return poped;
			 }
        },
		     'push': function (element) { 
              array=compactare(array,0,"in",element);
        }
		 
    }
}

/////////////////////////////////////|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

/////////////////////////////////////////////BRICK GURU MAIN OP\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
BricksGuru.prototype.construct=function()
{
 this.element_prop={width:0,height:0};
 this.innerTemp={};
 this.offsetTemp={};
    if (window.innerWidth) {
        this.innerTemp={x:window.innerWidth, y:window.innerHeight};
    } else if (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) {
        this.innerTemp={x:document.body.parentNode.clientWidth, y:document.body.parentNode.clientHeight};
    } else if (document.body && document.body.clientWidth) {
       this.innerTemp={x:document.body.clientWidth, y:document.body.clientHeight};
    }
    if (window.pageYOffset) {
        this.offsetTemp={o_x:window.pageXOffset, o_y:window.pageYOffset};
    } else if (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) {
       this.offsetTemp={o_x:document.documentElement.scrollLeft,o_y:document.documentElement.scrollTop};
    } else if (document.body && document.body.clientWidth) {
        this.offsetTemp={o_x:document.body.scrollLeft, o_y:document.body.scrollTop};
    }
 this.window_prop={
     x:this.innerTemp.x,
     y:this.innerTemp.y,
     offset_x:this.offsetTemp.o_x,
     offset_y:this.offsetTemp.o_y
};
 this.create=function(type,properties)
	{ 
		  return new Element(type,properties);
		}
 this.use=function(id)
    {
		  return new Element("id",id);
		}
}
/////////////////////////////////////////end brick guru main ops\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//////////////////////////////DOM operations\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
DomCompute.prototype.construct=function()
{ 
  this.body=document.body;
  this.total_nodes=window.document.childNodes;
  this.fragment=function(nr,type) ////////////return a fragment with a series of elements\\\\\\\\\\\
   {
	   var frag = document.createDocumentFragment();
        for( var i = 0, p; i < nr-1; i++ ) {
          p = document.createElement(type);
          frag.appendChild(p);
           }
		  return frag; 
	   }
}
DomCompute.prototype.objPadding=function(obj) {
	var elem = getIt(obj);
      if(elem==null) elem=obj;
	var l = 0;
	var r = 0;
	var t = 0;
	var b = 0;
	if (elem.currentStyle)
	{
		if (elem.currentStyle.paddingLeft)
			l = parseInt(elem.currentStyle.paddingLeft, 10);
		if (elem.currentStyle.paddingRight)
			r = parseInt(elem.currentStyle.paddingRight, 10);
		if (elem.currentStyle.paddingTop)
			t = parseInt(elem.currentStyle.paddingTop, 10);
		if (elem.currentStyle.paddingBottom)
			b = parseInt(elem.currentStyle.paddingBottom, 10);
	}
	else if (window.getComputedStyle)
	{
		l = parseInt(window.getComputedStyle(elem,null).paddingLeft, 10);
		r = parseInt(window.getComputedStyle(elem,null).paddingRight, 10);
		t = parseInt(window.getComputedStyle(elem,null).paddingTop, 10);
		b = parseInt(window.getComputedStyle(elem,null).paddingBottom, 10);
	} 
	if (isNaN(l) == true) l = 0;
	if (isNaN(r) == true) r = 0;
	if (isNaN(t) == true) t = 0;
	if (isNaN(b) == true) b = 0;
	return {l:(l),r:(r),t:(t),b:(b)};
}
DomCompute.prototype.objSize=function(obj,type,width,height) {
    var elem = getIt(obj);
    if(elem==null) elem=obj;
    if(type==null) type="get";
    if(type=="set") {elem.width=width; elem.height=height; }
    var w = 0;
    var h = 0;
    if (elem.offsetWidth) {
			w = elem.offsetWidth; h = elem.offsetHeight;
    } else if (elem.clip && elem.clip.width) {
			w = elem.clip.width; h = elem.clip.height;
    } else if (elem.style && elem.style.pixelWidth) {
			w = elem.style.pixelWidth; h = elem.style.pixelHeight;
    }
    
    w = parseInt(w, 10);
    h = parseInt(h, 10);
    
   // remove any original element padding
   var padding = this.objPadding(elem);
   w -= (padding.l + padding.r);
   h -= (padding.t + padding.b);
   return {w:(w), h:(h)};
}
DomCompute.prototype.getMargins=function(victim)
 {
	 var size=dom.objSize(victim); 
	 var left_=(parseInt(pos.getLeft(victim)));
	 var right_=(left_+parseInt(size.w));
	 var top_=(parseInt(pos.getTop(victim)));
	 var bottom_=(top_+parseInt(size.h));
	 return {
		     left:left_,
			 right:right_,
			 top:top_,
			 bottom:bottom_
		 };
	 
 }
DomCompute.prototype.attributes=function(obj,meth,name,value) ////////////////////computes the attributed of an html dom object
{    
    if(meth=="get"){
		for( var x = 0; x < obj.attributes.length; x++ ) {
         if( obj.attributes[x].nodeName.toLowerCase() == name ) {
			  return obj.attributes[x].nodeValue;	
           }
      }
	}
    else
	{
	    	obj.setAttribute(name,value);
		}
	}
DomCompute.prototype.anchors=function(name) ////////////////return a specified link\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
{
	var anchorTags = document.getElementsByTagName("a");
    for (var i = 0; i < anchorTags.length ; i++)
      {
        if(anchorTags[i].href==name) return anchorTags[i];
      }
	}
DomCompute.prototype.insertAfter=function( referenceNode, newNode ) //////////////inserts a nod after reference nod\\\\\\\\\\\\\
{
    referenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling );
}	

DomCompute.prototype.navigate=function(type,nod,value){ //////////////////////operations on nods\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  switch(type) {
	   case "first_parent": 
	                  return nod.parentNode;
                   break;
	   case "first_child": 
	                  return nod.firstChild;
                   break;	
	   case "last_child": 
	                  return nod.lastChild;
                   break;				   
	  case "next_sibling": 
	            var temp=nod.nextSibling;
				 while(temp.nodeType==3){
					 nod=nod.nextSibling;
				 }
	             return  nod.nextSibling; 
                   break;
      case "first_sibling":
	             var tempObj=nod.nextSibling;   
				 while(tempObj.nodeType==3)
				 {
					 	 tempObj=tempObj.nextSibling;
					 }
                  return tempObj;
                 break;
      case "last_sibling":
				 var temp=nod.parentNode.lastChild;	  
				 while(temp.nodeType==3){
				  temp=temp.previousSibling;
				 }
				 return temp;  
                 break;
	case "swap": 
	         nod.parentNode.replaceChild(value.cloneNode(true), nod);
             value.parentNode.replaceChild(nod.cloneNode(true), value);
	         break;
	case "replace_child": 
	           var parent=dom.navigate("first_parent",nod);
			    try{
	             parent.replaceChild(nod,value);
				 }
				catch(e)
				 {
					 alert(e);
					 }
	            break;
           }
}
////////////////////////////////////////////end DOM operations\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\	

//////////////////////////////////////////////////////////Brick elements operations\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Element.prototype.construct=function(type,properties)
{ 
  
   if(type!="id"){  /////creates an eleement with the given properties\\\\
	      var prop=new Array(),chunk=new Array(),rule;
		  this.obj=document.createElement(type);
		  document.body.appendChild(this.obj);
		  if(properties!=null)
		   {
			   prop=properties.split(","); 
			    for(var i=0;i<=prop.length-1;i++)
				 {  
					chunk=prop[i].split("=");
				    rule=chunk[0];
				    this.obj=addCSS(this.obj,chunk[0],chunk[1]);
				 }
		   }
       }
	 else
	  { ///////// return an element as an object\\\\\\\\\\
		  this.obj=getIt(properties); 
		  }
	}
Element.prototype.replace=function(id)
{         
 	 dom.navigate("replace_child",getIt(id),this.obj);
	}
Element.prototype.swap=function(id)
{         
 	 dom.navigate("swap",getIt(id),this.obj);
	}	
Element.prototype.resizeTo=function(width)
{
  var NewWidth =width;
  var NewHeight = Math.round(NewWidth * .667); 
  dom.objSize(this.obj,"set",NewWidth ,NewHeight );
}	
Element.prototype.limitText=function($type,limit,print_id)
{    
  //observer.activate("onkeydown",this.obj,'','',"drag_handler.dragOff");
  if($type=="chars")
	var nrc=this.obj.value.length;
 else  if($type=="words")
   {
	  var tmp=this.obj.value.split(" ");
	  var nrc=tmp.length;
	   } 
	var ramase=limit-nrc;
	if(ramase<=0)
	{
	var text_redus=this.obj.value.substr(0,limit);
	this.obj.value=text_redus;
	ramase=limit;
     }
    if(getIt(print_id).readOnly ==false)	 getIt(print_id).readOnly =true;  
	var afis=getIt(print_id);
	afis.value=ramase+'/'+limit;
	 
	}
Element.prototype.filter=function(type,nr) { ///////////////////use filters on elements\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
	  var element=this.obj;  
      var style = element.style;
	if(type='alpha'){
	  var alpha=nr; 
      if( style.MozOpacity != undefined ) { //Moz and older
       style.MozOpacity=(alpha/100);   //restrict max opacity to prevent a visual popping effect in firefox, moz rage 0.0 .. 1.0 (0.(9))
      }
      else if( style.filter != undefined ) { //IE
        style.filter = "alpha(opacity=0)"; 
        element.filters.alpha.opacity = ( alpha ); 
      }
      else if( style.opacity != undefined ) { //Opera
      style.opacity =alpha;
      }
    }
}
Element.prototype.dragOn=function()
{  
if(contains(dragArray,this)){
  dragObject=this;
if(dragObject.style.position!="absolute") dragObject.style.position="absolute";
   observer.activate("onmouseup","document",'','',"drag_handler.dragOff");
   pos.offsetY=(XY.y-parseInt(pos.getTop(dragObject)));
   pos.offsetX=(XY.x-parseInt(pos.getLeft(dragObject)));	
   	     drag_flag=1;  
    	 document.body.style.cursor=cursors[5];
	     observer.activate("interval","DragON()",'',1); 
		 observer.activate("kill_select_start","document",'','',"function () { return false; }"); ///////// no text selections
		 observer.activate("IE_drag_start"); //////////////////only for IE
      } 
	   return false;
	}
Element.prototype.dragOff=function(){
    	   observer.activate("kill_onmouseup","document",'','',"drag_handler.dragOff"); 
		   observer.activate("kill_interval","DragON()",'',1);
		   observer.activate("select_start_on","document",'','',null);
		   observer.activate("kill_IE_drag");
		   drag_flag=0;
		   dragObject=null;
		   XY.x=0;
		   XY.y=0;
		document.body.style.cursor=cursors[0];
	}	
	
Element.prototype.drag=function(type) /////////////////drags an element after the mouse\\\\\\\\\\\\\\\\\\\
 {  observer.activate("onmousemove","document","",'',"updateMouse"); 
    dragObject  = this.obj;
   if(type==null || type=="mousedown"){
	  drag_handler=this;
      observer.activate("onmousedown",dragObject,"absolute",'',drag_handler.dragOn);
   } 
    dragArray[dragArray.length]=dragObject; 
    }
Element.prototype.resizeOn=function()
{ 
	if(contains(resizeArray,this)){
       resObject=this; 
       observer.activate("onmouseup","document",'','',"resize_handler.resizeOff");
       res_flag=1;  
	   observer.activate("interval","ResizeON()",'',1); 
      } 

	}
Element.prototype.startResize=function()
{ 
	alert("test");
//  resize_handler.resizeTo(400);
	}	
Element.prototype.resizeOff=function()
{
	
	}
Element.prototype.resize=function() /////////////////drags an element after the mouse\\\\\\\\\\\\\\\\\\\
 {  observer.activate("onmousemove","document","",'',"updateMouse"); 
    resObject  = this.obj;
    resize_handler=this;
    observer.activate("onmouseover",resObject,"absolute",'',resize_handler.resizeOn);
    resizeArray[resizeArray.length]=resObject; 
    }	
Element.prototype.glue=function(pilar,offset_type,offset,offset_)
	      {  
        if(this.obj.style.position!="absolute") this.obj.style.position="absolute";
        if(offset_type!=null)
		    {
			if(offset_type=="left"){
		        var left=parseInt(pos.getLeft(getIt(pilar)))+offset; 
	              var top=parseInt(pos.getTop(getIt(pilar)));		
			}
			else if(offset_type=="top")
			{
				var left=parseInt(pos.getLeft(getIt(pilar))); 
	                  var top=parseInt(pos.getTop(getIt(pilar)))+offset;		
				}
			 else
			   {
				 var left=parseInt(pos.getLeft(getIt(pilar)))+offset; 
	              var top=parseInt(pos.getTop(getIt(pilar)))+offset_; 
				   }
			}
			else
			{  
	
		      var left=parseInt(pos.getLeft(getIt(pilar))); 
	            var top=parseInt(pos.getTop(getIt(pilar)));


				}  
		pos.move(this.obj,left,top)		
		  }
//////////////////////////////////////////////////////end Brick elements operatiojns \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

////////////////////////////////////////////Positioning operations \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Positions.prototype.construct=function()
{
this.lastMouseX=0;
this.lastMouseY=0;
this.offsetX=0;
this.offsetY=0;
this.getLeft=function(obj)
	      {   
            var curleft = 0; 
             while(obj.offsetParent) {
                curleft += obj.offsetLeft;
                obj = obj.offsetParent;
             } 
            return curleft;
         }
 this.getTop=function(obj) 
        {
            var curtop = 0;
            while(obj.offsetParent)     {
                 curtop += obj.offsetTop;
                 obj = obj.offsetParent;
            }
          return curtop;
        }
 this.getMouse=function (e) {
	       if(e.pageX ){ 
		       return {x:e.pageX, y:e.pageY};
	          }
      	return {
	        	x:e.clientX + document.body.scrollLeft - document.body.clientLeft,
	        	y:e.clientY + document.body.scrollTop  - document.body.clientTop
	           };
 
		   }
 this.move=function(victim,left,top)
		{ 
      if(victim.style.position!="absolute") victim.style.position="absolute";
		if(victim.style){  
		 victim.style.top=top+"px"; 
		 victim.style.left=left+"px"; 
		}
		else
		{  
		 victim.top=top+"px";
		 victim.left=left+"px"; 
		
			}
		}

}
/////////////////////////////////////////////end positioning operations]\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

////////////////////////////////////////////////////////end prototypes and constructors\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

//////////////////////////////initializari]\\\\\\\\\\\\\
var brick=new BricksGuru("0");
var pos=new Positions("0");
var dom=new DomCompute("0");
var iterator=new Iteration("0");
var observer=new Observer("0");
//////////////////////////end inituri\\\\\\\\\\\\\\\\\\\\

	
