var mTools = {
	findPosX : function(obj) {
		var curleft = 0;
		if (obj.offsetParent){
			while (obj.offsetParent){
				curleft += obj.offsetLeft;
				obj = obj.offsetParent;
			}
		}	else if (obj.x) {
			curleft += obj.x;
		}
		return curleft;
	},
	
	findPosY : function(obj) {
		var curtop = 0;
		if (obj.offsetParent) {
			while (obj.offsetParent) {
				curtop += obj.offsetTop;
				obj = obj.offsetParent;
			}
		}	else if (obj.y) {
			curtop += obj.y;
		}
		return curtop;		
	},
	
	getCursorPosition : function(e) {
		if (!e) var e = window.event;
		if (e.pageX || e.pageY) {
			var posx = e.pageX;
			var posy = e.pageY;
		}	else if (e.clientX || e.clientY) {
			var posx = e.clientX + document.documentElement.scrollLeft;
			var posy = e.clientY + document.documentElement.scrollTop;
		}
		return [posx, posy];
	}
}


function picChange()
{   
   $('#picNagiv li a').mouseover(function(e){
      var myImgs=$(this).children();
      myImgs.attr('src', '/common/images/point1.gif');      
      
      var pos = mTools.getCursorPosition(e);/*
      var mySpan=$(this).find('span');
      mySpan.css({top:pos[0], left:pos[1]});*/
      
      
      myClass=$(this).parent().attr('class');

      var myDiv=$('#mcont .'+myClass);
      myDiv.css("top",pos[1]-120);
      myDiv.css("left",pos[0]-15);
      //alert(pos[0]+" "+pos[1]);
   });
   
   $('#picNagiv li a.link').mouseout(function(){
      var myImgs=$(this).children();
      myImgs.attr('src', '/common/images/point.gif');
      
      myClass=$(this).parent().attr('class');
      var myDiv=$('#mcont .'+myClass);
      myDiv.css("top",-2000);
   }); 
   
      $('#picNagiv li a.current').mouseout(function(){
      var myImgs=$(this).children();
      
      myClass=$(this).parent().attr('class');
      var myDiv=$('#mcont .'+myClass);
      myDiv.css("top",-2000);
   });
   
   //previous button
   $('#picNagiv li.prev a').mouseover(function(){
      var myImgs=$(this).children();
      myImgs.attr('src', '/common/images/point4.gif');
   });
   
   $('#picNagiv li.prev a').mouseout(function(){
      var myImgs=$(this).children();
      myImgs.attr('src', '/common/images/point3.gif');
   });    

   //next button
   $('#picNagiv li.next a').mouseover(function(){
      var myImgs=$(this).children();
      myImgs.attr('src', '/common/images/point6.gif');
   });
   
   $('#picNagiv li.next a').mouseout(function(){
      var myImgs=$(this).children();
      myImgs.attr('src', '/common/images/point5.gif');
   });       
   
} 


$(document).ready(function(){
   picChange();
 });