var $scrolltimer;



/*
function to move the selected inde
*/


function moveCombo(selectBox,value)
{
	if(parseInt(value) == 0)
	{
		if(parseInt(selectBox.selectedIndex) < parseInt(selectBox.options.length))
		{
			selectBox.options[parseInt(selectBox.selectedIndex) + 1].selected = "true";
		}
		else
		{
			selectBox.options[parseInt(selectBox.selectedIndex) - 1].selected = "true";
		}
	}
}



function openLayer($layerId,checkbox)
{
	$d = document.getElementById("advancesearch_" + $layerId);
	if(checkbox.checked == true)
	{
		$d.style.display  = "block";
	}
	else
	{
		$d.style.display  = "none";
	}
}
function onloaddeatils()
{


	$alllayer 	 = document.getElementsByTagName("DIV");
	$alla		 = document.getElementsByTagName("A");	
	
	
	
	for($count = 0;$count < $alla.length;$count++)
	{
		if($alla[$count].href.match(/demo.mavieco.fr/g) == "demo.mavieco.fr")
		{
		}
		else if($alla[$count].href.match(/www.mavieco.fr/g) == "www.mavieco.fr")
		{
		}
		else if($alla[$count].href.match(/mavieco.fr/g) == "mavieco.fr")
		{
		}

		else if($alla[$count].href.match(/javascript:/g) == "javascript:")
		{
		}
		else if($alla[$count].href.match(/mailto:/g) == "mailto:")
		{
		}

		else
		{
			$d_x = $alla[$count].innerHTML;
			$alla[$count].href = $baselocation  + "changeurl.php?url=" +  escape($alla[$count].href);
			$alla[$count].innerHTML = $d_x;
		}
	}
	
	$leftclass = null;
	$rightclass = null;
	$contentclass = null;
	$mainmenuclass = null;
	
	$_hieight = 0;
	$_x_top  = 0;

	for($count = 0;$count < $alllayer.length;$count++)
	{
		$datacheck = 0;
		if($alllayer[$count].className == "midleft")	{ $leftclass = $alllayer[$count];	$datacheck = 1; }
		if($alllayer[$count].className == "midright")	{ $rightclass = $alllayer[$count];	$datacheck = 1; }
		if($alllayer[$count].className == "menubg")	{ $mainmenuclass = $alllayer[$count]; }
		
		if($alllayer[$count].className == "menu" || $alllayer[$count].className == "menuon")	
		{
			
			$_x_top = parseInt($_x_top) +  20;
			$_x_top = parseInt($alllayer[$count].offsetWidth) + $_x_top;
			
		}
		
		
		
		
		if($datacheck > 0)
		{
			if(parseInt($alllayer[$count].offsetHeight) > $_hieight)
			{
				$_hieight = parseInt($alllayer[$count].offsetHeight);
				
			} // end of the if condition
		}
		
		
		if($alllayer[$count].className == "rowlm")
		{
			$alllayer[$count].onmouseover = function ()
			{
				this.className='rowlmover';
			}
			
			$alllayer[$count].onmouseout = function ()
			{
				this.className='rowlm';
			}
			
		}
	}
	

	$x = document.getElementById("menudisplayoff");
	$x.style.width = $_x_top + "px"	;
	
	
	
	try
	{
		$_hieight = parseInt($_hieight) + 10;
		if($rightclass != null) { $rightclass.style.height = $_hieight + "px"; }
		if($leftclass != null) { $leftclass.style.height = $_hieight + "px"; }
	}
	catch(e)
	{

	}	
	
	
	$_hieight = 0;
	// we are checking for the left and right
	
	
	
	for($count = 0;$count < $alllayer.length;$count++)
	{
		$datacheck = 0;
		if($alllayer[$count].className == "leftpanel")	{ $leftclass = $alllayer[$count];	$datacheck = 1; }
		if($alllayer[$count].className == "rightpanelin")	{ $rightclass = $alllayer[$count];	$datacheck = 1; }
		
		if($datacheck > 0)
		{
			if(parseInt($alllayer[$count].offsetHeight) > $_hieight)
			{
				$_hieight = parseInt($alllayer[$count].offsetHeight);
				
			} // end of the if condition
		}
	}
	
	// now try to adjust the address details on the chessbury site
	try
	{
		$_hieight = parseInt($_hieight) + 10;
		if($rightclass != null) { $rightclass.style.height = $_hieight + "px";}
		if($leftclass != null) { $leftclass.style.height = $_hieight + "px";}
	}
	catch(e)
	{

	}
	






	
	$imgs= document.getElementsByTagName("img");
	$selimgs= new Array();
	for($i=0;$i<$imgs.length;$i++)
	{
		
		if($imgs[$i].className=="imageborder")
		{
			
			$imgs[$i].onclick = function ()
			{
				$src=this.src.split("/");
				window.open($baselocation+ "enlarge.php?im="+$src[5],"","width=700,height=500,statusbar=no,scrollbars=1");
				
			};
		}
		
	}	
	
	
	//now we have make the change in sthe system
	$previous = document.getElementById("topmenu_previous");
	$next = document.getElementById("topmenu_next");
	
	// writing next function
	$next.onmouseover = next_scrollstart;
	$next.onmouseout = next_scrollstop;

	// writing next function
	$previous.onmouseover = previous_scrollstart;
	$previous.onmouseout = previous_scrollstop;


}


function previous_scrollstop()
{
	clearTimeout($scrolltimer);
}

function previous_scrollstart()
{
	
	clearTimeout($scrolltimer);
	$inner = document.getElementById("menudisplayoff");		
	$data = $inner.style.marginLeft.split("px");
	$data1 = $inner.style.width.split("px");
	
	if($data[0] == "")	{	$data[0]  = 0;	}
	
	
	$x_data = parseInt($data1[0]) + parseInt($data[0]);
	if($data[0] < 0)
	{
		$x = document.getElementById("menudisplayoff");			
		$x.style.marginLeft	= (parseInt($data[0])+ 5) + "px";
		$scrolltimer = setTimeout("previous_scrollstart()",50);
	}
	else
	{
		clearTimeout($scrolltimer);
	}
} // end ofthe function






function next_scrollstop()
{
	clearTimeout($scrolltimer);
}

function next_scrollstart()
{
	
	clearTimeout($scrolltimer);
	$inner = document.getElementById("menudisplayoff");		
	$data = $inner.style.marginLeft.split("px");
	$data1 = $inner.style.width.split("px");
	
	if($data[0] == "")	{	$data[0]  = 0;	}
	
	
	$x_data = parseInt($data1[0]) + parseInt($data[0]);
	if($x_data > 650)
	{
		$x = document.getElementById("menudisplayoff");			
		$x.style.marginLeft	= (parseInt($data[0]) - 5) + "px";
		$scrolltimer = setTimeout("next_scrollstart()",50);
	}
	else
	{
		clearTimeout($scrolltimer);
	}
} // end ofthe function

// this will load file when all the file is loading
window.onload = onloaddeatils;


function collectWidth(obj){

var wVal=0

var objs=obj.document.getElementsByTagName('*')

for (var i_tem = 0; i_tem < objs.length; i_tem++){

wVal=Math.max(objs[i_tem].offsetWidth, wVal)

}

return wVal;

}

 

function chnageWidthHeight(frameObj){

if ((frameObj.contentDocument && (frameObj.contentDocument.body.offsetHeight||frameObj.contentDocument.documentElement.offsetHeight))||frameObj.Document && frameObj.Document.body.scrollHeight){

var contentHeight=window.opera? frameObj.contentDocument.documentElement.offsetHeight : frameObj.contentDocument? frameObj.contentDocument.body.offsetHeight : frameObj.Document.body.scrollHeight+4

var contentWidth=window.opera? collectWidth(frameObj.contentDocument) : frameObj.contentDocument? frameObj.contentDocument.documentElement.offsetWidth : frameObj.Document.body.scrollWidth

var frameWidth=frameObj.offsetWidth

var frameheight=frameObj.offsetheight

if (window.opera&&frameWidth>=contentWidth)

frameObj.contentDocument.body.style.overflow='hidden'

frameObj.style.overflow='visible'

frameObj.height = frameheight<contentHeight? contentHeight+100 : contentHeight+100;

frameObj.width = frameWidth<contentWidth? contentWidth : frameWidth;

}

 

                if((typeof frameObj.Document) != "undefined")

                {

                                $maindata = frameObj.Document.body.getElementsByTagName("A");

                }

                else

                {

                                $maindata = frameObj.contentDocument.body.getElementsByTagName("A");

                }

                for($count =0;$count < $maindata.length;$count++)

                {

                                $maindata[$count].href="#";

                } // end of the for loop

}

