var url='http://83.149.84.229/';

$(document).ready(function() {
   
	$(document).pngFix(); 
//	if($('#visualsearch_mid')({
		animatedcollapse.addDiv('visualsearch_mid');
		animatedcollapse.init();
//	}

	if($(".popup")){
		$(".popup").fancybox({
				'hideOnContentClick': true, 
				'overlayShow':	true,
				'overlayOpacity':0.5,
				'padding':10
		  });
	}


});

function getPosition(obj){
    var topValue= 0,leftValue= 0;
    while(obj){
	leftValue+= obj.offsetLeft;
	topValue+= obj.offsetTop;
	obj= obj.offsetParent;
    }
	var finalvalue = new Array;
    finalvalue['x'] = leftValue;
	finalvalue['y'] =  topValue;
    return finalvalue;
}

 function coord(e, image )
  {
    var x = 0 ;
    var y = 0 ;
	if (navigator.userAgent.indexOf( "MSIE" ) != -1) { // grab the x-y pos.s if browser is IE
		x = event.clientX + document.body.scrollLeft;
		y = event.clientY + document.body.scrollTop;
	}
	else {  // grab the x-y pos.s if browser is NS
		x = e.pageX;
		y = e.pageY;
	}  	

	offset = getPosition(image);

	x -= offset['x'];
	y -= offset['y'];
/*
    if ( navigator.userAgent.indexOf( "MSIE" ) != -1 ) {
      x -= imageholder.offsetLeft + 2 ;
      y -= imageholder.offsetTop + 2 ;
    } else {
		alert(imageholder);
      x -= imageholder.x ;
      y -= imageholder.y ;
    }
*/
	document.getElementById('x').value=x;
	document.getElementById('y').value=y;
	document.form1.submit();
  } 
  
function switchform(id1, id2){
	$("#"+id1).toggle();
	$("#"+id2).toggle();
}  

var lastid='';
function showdiv(id){
	if(lastid && lastid!=id){
		$('#'+lastid).css('backgroundImage', 'url('+url+'images/maximise.gif)');
		$('#div_'+lastid).hide();
	}
	if($('#div_'+id).css('display')=='none'){
		$('#'+id).css('backgroundImage', 'url('+url+'images/minimise.gif)');
	} else {
		$('#'+id).css('backgroundImage', 'url('+url+'images/maximise.gif)');
	}
	$('#div_'+id).toggle("", function() {
		lastid=id;
	});
}

