
	
function megaFormStart(divID,fadeOut) {
   

	var user_agent = navigator.userAgent.toLowerCase()
	var pos_x = 0;
	var pos_y = 0;

	if(!fadeOut) fadeOut='fadeOutFon';
	var fadeOutFon = document.getElementById(fadeOut);
	var objBody = document.getElementsByTagName("body").item(0);
	
	fadeOutFon.style.zIndex = '9999';
	fadeOutFon.style.position = 'absolute';
	fadeOutFon.style.top = 0;
	fadeOutFon.style.left = 0;
	fadeOutFon.style.background = '#d0e7e7';
	fadeOutFon.style.width = getPageSize()[0] + 'px';
	fadeOutFon.style.height = $(document).height() + 'px';
	fadeOutFon.style.display = '';
	fadeOutFon.style.marginLeft = '-17px';
	fadeOutFon.style.opacity = 0.5;
	if ($.browser.msie) {
		fadeOutFon.style.marginLeft = '0';
		setOpacity(fadeOutFon,0.5)
	}
	
	
	 
//     new Effect.Opacity(fadeOutFon, { duration:0.3, from:0, to:0.5 });

   addForm = document.getElementById(divID);
   addForm.style.zIndex = '10000';
   addForm.style.position = 'absolute';
   addForm.style.opacity = 0;
   if ($.browser.msie) setOpacity(addForm,0.0)
   addForm.style.display = '';
   $('#'+divID).animate({opacity:'1'},1000);
   
   document.body.style.overflowX = 'hidden';
   
//   new Effect.Opacity(addForm, { duration:1, from:0, to:1});



//SCROLL HEIGHT
	var y;
	if (self.pageYOffset) {y = self.pageYOffset;}
	else if (document.documentElement && document.documentElement.scrollTop){y = document.documentElement.scrollTop;}
	else if (document.body)	{y = document.body.scrollTop;}

	pos_y = y;

//PAGE HEIGHT  & WIDTH

	if (self.innerHeight){x = self.innerWidth;}
	else if (document.documentElement && document.documentElement.clientHeight){x = document.documentElement.clientWidth;}
	else if (document.body) {x = document.body.clientWidth;}
	
	pos_x = x;
	
	addForm.style.width = pos_x - 60 + 'px';
	
	addForm.style.left = "30px";
    addForm.style.top = pos_y + 100 + "px";

}

function megaFormFinish(divID,fadeOut) {
        if(!fadeOut) fadeOut='fadeOutFon';
        var fadeOutFon = document.getElementById(fadeOut);
		addForm = document.getElementById(divID);
		fadeOutFon.style.display = 'none';
		addForm.style.display = 'none';
		
		document.body.style.overflowX = 'visible';
      
}

function getPageSize(){
      var xScroll, yScroll;
      if (window.innerHeight && window.scrollMaxY) {           xScroll = document.body.scrollWidth;
       yScroll = window.innerHeight + window.scrollMaxY;
   } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
       xScroll = document.body.scrollWidth;
       yScroll = document.body.scrollHeight;
   } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
       xScroll = document.body.offsetWidth;
       yScroll = document.body.offsetHeight;
   }
         var windowWidth, windowHeight;
   if (self.innerHeight) {    // all except Explorer
       windowWidth = self.innerWidth;
       windowHeight = self.innerHeight;
   } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
       windowWidth = document.documentElement.clientWidth;
       windowHeight = document.documentElement.clientHeight;
   } else if (document.body) { // other Explorers
       windowWidth = document.body.clientWidth;
       windowHeight = document.body.clientHeight;
   }             // for small pages with total height less then height of the viewport
   if(yScroll < windowHeight){
       pageHeight = windowHeight;
   } else {
       pageHeight = yScroll;
   }

   // for small pages with total width less then width of the viewport
   if(xScroll < windowWidth){           pageWidth = windowWidth;
   } else {
       pageWidth = xScroll;
   }

   var test1 = document.body.scrollHeight;
   var test2 = document.body.offsetHeight
   if (test1 > test2) // all but Explorer Mac
   {
       x = document.body.scrollWidth;
       y = document.body.scrollHeight;
   }
   else // Explorer Mac;
        //would also work in Explorer 6 Strict, Mozilla and Safari
   {
       x = document.body.offsetWidth;
       y = document.body.offsetHeight;
   }
      arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
   return arrayPageSize;
}

function setOpacity( element, alpha ) {
	var style = element.style;
	if( style.MozOpacity != undefined ) { //Moz and older
		style.MozOpacity = alpha;
	}
	else if( style.filter != undefined ) { //IE
		style.filter = "alpha(opacity=0)";
		element.filters.alpha.opacity = ( alpha * 100 );
	}
	else if( style.opacity != undefined ) { //Opera
		style.opacity = alpha;
	}
}







 
 function fixPNG(element)
{
 if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
 {
 var src;

if (element.tagName=='IMG')
{
if (/\.png$/.test(element.src))
{
src = element.src;
element.src = "assets/images/width.gif";

}
}
else
{
src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
if (src)
{
src = src[1]; 
element.runtimeStyle.backgroundImage="none";
}
}
if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}
}
