// colors
  var menuItembg = '#f9f9f9'; 
  var menuItembrdr = '#666';
  var menuItemBrdrOrig = '#f5f5f5';
  var menuItemBrdrTop = '#fafafa';
  var menuClkBgClr = '#666';
  var fclr = '#3bd';
  var fclr_orig = '#000';
  
  var frmBgClr = '#eee';
  var frmBgClr_clk = '#c6e5fb';
  var frmBgClr_mout = '#ddd';
  var frmBgClr_movr = '#7edef4';
  
  var linkBrdr_movr = '#fff';
  var linkBrdr_mout = '#fff';

  var rowBgClr = '#afa';
  var rowBgBrdrClr = '#F00';
  
// state varriables
var activeListId = "container_controller_0";
var selectedCMSMenu = 'tab1';

// page effects
var hasAccords = false;
var hasFader = false;

window.addEvent('domready', function(){

<!-- Create Menu Settings: (Menu ID, Is Vertical, Show Timer, Hide Timer, On Click ('all', 'main' or 'lev2'), Right to Left, Horizontal Subs, Flush Left, Flush Top) -->
qm_create(0,false,120,500,false,false,false,false,false);

var ells = $$('#menu .menuItem');
   for(var i = 0;i < ells.length;i++){
	$(ells[i]).addEvent('mouseover', function () { 
               this.style.backgroundColor = menuItembg ;
               this.style.borderLeft = '1px solid ' + menuItembrdr ; 
               this.style.borderRight = '1px solid ' + menuItembrdr ;
               this.style.borderTop = '1px solid ' + menuItemBrdrTop;
               this.style.color = fclr;
               this.style.cursor = 'pointer';
         });

	$(ells[i]).addEvent('mouseout', function () { 
              this.style.backgroundColor = ''; 
              this.style.borderRight = '1px solid #fff';
              this.style.borderLeft = '1px solid #fff';
              this.style.borderBottom = '1px solid ' + menuItemBrdrOrig;
              this.style.borderTop = '1px solid #fff'; 
              this.style.color = fclr_orig;
         });

      $(ells[i]).addEvent('click', function () { 
              this.style.backgroundColor = menuClkBgClr; 
              this.style.color = fclr;
         });
   }

ells = $$('.formfield');
    for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('mouseover', function () { 
               this.style.border = '1px solid ' + frmBgClr_movr;               
         });
       $(ells[i]).addEvent('focus', function () { 
               this.style.border = '1px solid ' + frmBgClr_movr;
               this.style.backgroundColor = frmBgClr_clk;               
         });
		
		$(ells[i]).addEvent('mouseout', function () { 
               this.style.border = '1px solid ' + frmBgClr_mout;               
         });
         		
	$(ells[i]).addEvent('click', function () { 
               this.style.backgroundColor = frmBgClr_clk;               
         });
		
        $(ells[i]).addEvent('blur', function () { 
               this.style.backgroundColor = frmBgClr;
               this.style.border = '1px solid ' + frmBgClr_mout;                 
         });
		
}

ells = $$('.formarea');
    for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('mouseover', function () { 
               this.style.border = '1px solid ' + frmBgClr_movr;               
         });
       $(ells[i]).addEvent('focus', function () { 
               this.style.border = '1px solid ' + frmBgClr_movr;
               this.style.backgroundColor = frmBgClr_clk;               
         });
		
		$(ells[i]).addEvent('mouseout', function () { 
               this.style.border = '1px solid ' + frmBgClr_mout;               
         });
         		
	$(ells[i]).addEvent('click', function () { 
               this.style.backgroundColor = frmBgClr_clk;               
         });
		
        $(ells[i]).addEvent('blur', function () { 
               this.style.backgroundColor = frmBgClr;
               this.style.border = '1px solid ' + frmBgClr_mout;                 
         });
		
}

ells = $$('.formtextarea');
    for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('mouseover', function () { 
               this.style.border = '1px solid ' + frmBgClr_movr;               
         });
       $(ells[i]).addEvent('focus', function () { 
               this.style.border = '1px solid ' + frmBgClr_movr;
               this.style.backgroundColor = frmBgClr_clk;               
         });
		
		$(ells[i]).addEvent('mouseout', function () { 
               this.style.border = '1px solid ' + frmBgClr_mout;               
         });
         		
	$(ells[i]).addEvent('click', function () { 
               this.style.backgroundColor = frmBgClr_clk;               
         });
		
        $(ells[i]).addEvent('blur', function () { 
               this.style.backgroundColor = frmBgClr;
               this.style.border = '1px solid ' + frmBgClr_mout;                 
         });
		
}

ells = $$('.formbtn');
    for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('mouseover', function () { 
               this.style.border = '1px solid ' + frmBgClr_movr;               
         });
       $(ells[i]).addEvent('focus', function () { 
               this.style.border = '1px solid ' + frmBgClr_movr;
               this.style.backgroundColor = frmBgClr_clk;               
         });
		
		$(ells[i]).addEvent('mouseout', function () { 
               this.style.border = '1px solid #aaa';               
         });
         		
	$(ells[i]).addEvent('click', function () { 
               this.style.backgroundColor = frmBgClr_clk;               
         });
		
        $(ells[i]).addEvent('blur', function () { 
               this.style.backgroundColor = frmBgClr;
               this.style.border = '1px solid ' + frmBgClr_mout;                 
         });
		
}

ells = $$('.link');
    for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('mouseover', function () { 
               this.style.backgroundColor = frmBgClr_clk;               
         });
     
		
		$(ells[i]).addEvent('mouseout', function () { 
               this.style.backgroundColor = '#fff';               
         });
		
}

ells = $$('.row1_0');
    for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('mouseover', function () { 
               this.style.backgroundColor = rowBgClr;  
               this.style.border = '1px solid ' + rowBgBrdrClr;                    
         });     		
	$(ells[i]).addEvent('mouseout', function () { 
               this.style.backgroundColor = '#fff';        
               this.style.border = '1px solid #fff';          
         });		
}

ells = $$('.row1_1');
    for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('mouseover', function () { 
               this.style.backgroundColor = rowBgClr;  
               this.style.border = '1px solid ' + rowBgBrdrClr;             
         });     		
	$(ells[i]).addEvent('mouseout', function () { 
               this.style.backgroundColor = '#fff';  
               this.style.border = '1px solid #fff';             
         });		
}

// vertical marketing top-10 list
ells = $$('.lilist_vert');
    for(var i = 0;i < ells.length;i++){         
	$(ells[i]).addEvent('click', function () { 
		this.style.width = "265px";	   
	 });			
    }

ells = $$('.litem');
for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('click', function () { 												
		if(window.ie){ // I HATE IE!!!
			$(activeListId).getParent().style.width = "215px";
			$(activeListId).getParent().style.backgroundImage = '';
			activeListId = this.id;		
			this.getParent().style.width = "265px";
			this.getParent().style.background = "url(/media/images/bgitem_active.png) no-repeat scroll";	
		}else{		
			$(activeListId).getParent().getParent().style.width = "215px";
			$(activeListId).getParent().getParent().style.backgroundImage = '';
			activeListId = this.id;		
			this.getParent().getParent().style.width = "265px";
			this.getParent().getParent().style.background = "url(/media/images/bgitem_active.png) no-repeat scroll";		   
		}
	 });	

}

// business cms tabs
ells = $$('.tab1');
 for(var i = 0;i < ells.length;i++){
         $(ells[i]).addEvent('mouseover', function () { 
			if(this.id != 	selectedCMSMenu){
               this.style.backgroundColor = '#99bbdd';  
               this.style.border = '1px solid #555';  
			   this.style.cursor = 'pointer';
			   this.style.color = '#fff';
			}
         });     		
	$(ells[i]).addEvent('mouseout', function () { 
				if(this.id != 	selectedCMSMenu){						  
               this.style.backgroundColor = '#fff';  
               this.style.border = '1px solid #ccc'; 
			   this.style.cursor = 'default';
			   this.style.color = '#000';
				}
         });	
	
	$(ells[i]).addEvent('click', function () { 
		$(selectedCMSMenu).style.backgroundColor = '';
		$(selectedCMSMenu).style.color = '#000';
		$(selectedCMSMenu).style.border =  '1px solid #ccc';  
		selectedCMSMenu = this.id;		
		this.style.backgroundColor = "#99bbcc";	});
}

}) 

function bodyShadow(){
    var bdiv = document.getElementById('contentWrap');
    var wrap1 = document.createElement("div");
    wrap1.className = "wrap1";
    var wrap2 = document.createElement("div");
    wrap2.className = "wrap2";
    var wrap3 = document.createElement("div");
    wrap3.className = "wrap3";
    var outerNode = bdiv.parentNode;
    outerNode.insertBefore(wrap1, bdiv);
    wrap1.appendChild(wrap2);
    wrap2.appendChild(wrap3);
    outerNode.removeChild(bdiv);
    wrap3.appendChild(bdiv); 
}

window.addEvent('domready', function() {
    if($('.toolTip') != null)
	 new Tips($$('.toolTip'), {maxOpacity: 0.9, maxTitleChars: 25});	

	//var myTips =  new Tips('.toolTip');
     if( document.getElementById('contentWrap') != null)
	  bodyShadow();

   // if(hasFader != null)
     // if(hasFader){
		//  nextImg();
         //var fader = new Fx.Style('pLogo', 'opacity', {duration: 500});   ;
         //$('pLogo').effect('opacity').set(0);
         //window.setInterval(fader.start(1),2000);
		 //window.setInterval(fader.start(0),2700);
 		 //window.setInterval('nextImg()',2500);
       
      //}
	  
	    if(hasAccords)
		 initAccords();
    
	 var reflects = $$('.reflect1');
	 for(var i = 0; i < reflects.length;i++){
		 $(reflects[i]).addReflection({opacity: 0.25, height: 0.1}); 
	 }

	 var reflects = $$('.reflect2');
	 for(var i = 0; i < reflects.length;i++){
		 $(reflects[i]).addReflection({opacity: 0.9, height: 0.2}); 
	 }


       
     
});



function initAccords(){
	
	//var stretchers = document.getElementsByClassName('stretcher');
	var stretchers = $$('.stretcher');
	var toggles = $$('.display'); 
	var activeToggle = 't1';
	var activeBg = 'url(/media/images/th_bg2.png)';
	var inactiveBg = 'url(/media/images/th_bg1.png)';
    var activeToggleFlg = false;
	
	//accordion effect
	var myAccordion = new Fx.Accordion(
		toggles, stretchers, {opacity: true, duration: 400, show: -1, alwaysHide: true}
	);
		
	for(var i = 0;i < toggles.length;i++){
	  $(toggles[i]).addEvent('mouseover', function () { 
			this.style.cursor = 'pointer';
                        this.style.border = '1px solid #09f';
		});
        
	  
	  $(toggles[i]).addEvent('mouseout', function () { 
			 this.style.cursor = 'normal';
                         this.style.border = '1px solid white';
	   });
	  
	   $(toggles[i]).addEvent('click', function () {
						
                        if(activeToggle == this.id){
                             if(activeToggleFlg){
                              $(activeToggle).style.background = inactiveBg;
                              activeToggleFlg = false;
                             }else{
                                $(activeToggle).style.background = activeBg;
                                activeToggleFlg = true;
                              }
                        }else{                        
			      $(activeToggle).style.background = inactiveBg;
			      activeToggle = this.id;
			      this.style.background = activeBg;
			      this.style.height = '30px';
				  activeToggleFlg = true;
                        }
               
	   });
	}		
		
}

function nextImg(){    
    if(ih < pimages.length){	   
	   ih++;
    }
	if(ih >= pimages.length){
	  ih = 0;  	 
	}
	$('pLogo').src = pimages[ih];
}


function openFtpWindow(){
	
new Windoo({
	"type": "iframe",
	"url": "/net2ftp",
	"width": 900,
	"height": 600,
	"top": 100,
	"left": 300,
	"title":  ftpWinNum + " :: Utropicmedia net2ftp",
	"resizeLimit": {
		"x": {
			"0": 400
		},
		"y": {
			"0": 330
		}
	},
	"ghost": {
		"resize": true
	},
	"container": false
})
.show();

 ftpWinNum++;




}

function openPxyWindow(){
	
	new Windoo({
	"type": "iframe",
	"url": "/binfo",
	"width": 900,
	"height": 600,
	"top": 100,
	"left": 300,
	"title":  pxyWinNum + " :: Utropicmedia web proxy",
	"resizeLimit": {
		"x": {
			"0": 400
		},
		"y": {
			"0": 330
		}
	},
	"ghost": {
		"resize": true
	},
	"container": false
})
.show();


 pxyWinNum++;

}

function openNQWindow() {

	new Windoo({
	"type": "iframe",
	"url": "https://www.utropicmedia.net/netquery/nquser.php",
	"width": 900,
	"height": 600,
	"top": 100,
	"left": 300,
	"title":  "Utropicmedia Network Tools",
	"resizeLimit": {
		"x": {
			"0": 400
		},
		"y": {
			"0": 330
		}
	},
	"ghost": {
		"resize": true
	},
	"container": false
})
.show();

}
		
		
function auracleLogin(){

  var user = $('newuid').getValue();
   var pass = $('password1').getValue();
   var url = "/auracle/xmlrpc/request.php?action=login&username=" + user + "&password=" + pass;
   
   new Ajax(url, { 	method: 'get', async: false }).request();
			

}		

function auracleLogout(){
   
    var url = "/auracle/?logout=1";
	new Ajax(url, { 	method: 'get', async: false }).request();

}


function startChat(){				
window.open( "http://utropicmedia.net/auracle/chatpane.php","chat", "width=500,height=500,top=150,left=150,resizable=yes,scrollbars=no,menubar=no,toolbar=no,status=no,location=no" );
}


/* global vars */
var ih = 0;
var ftpWinNum = 1;
var pxyWinNum = 1;

