function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function findPosX(obj)
{
	var curleft = 0;
	if(obj.offsetParent)
	while(1) 
	{
	  curleft += obj.offsetLeft;
	  if(!obj.offsetParent)
	    break;
	  obj = obj.offsetParent;
	}
	else if(obj.x)
	curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if(obj.offsetParent)
	while(1)
	{
	  curtop += obj.offsetTop;
	  if(!obj.offsetParent)
	    break;
	  obj = obj.offsetParent;
	}
	else if(obj.y)
	curtop += obj.y;
	return curtop;
}

function customValidationStyle(oElem, isValid)
{
	if (isValid)
	{
		//alert(oElem.id);
		//oElem.style.backgroundColor = "";
		$('#' + oElem.id + 'valError').remove()
	}
		else
	{
		if ($('#' + oElem.id + 'valError').length == 0) {
			$('#' + oElem.id).after('<img id="' + oElem.id + 'valError" src="../images/delete.gif" class="fieldError" alt="' + oElem.title + '" title="' + oElem.title + '" />')
			//$('#' + oElem.id).after('<div id="' + oElem.id + 'valError" class="fieldError"></div>')
		}
		//oElem.style.backgroundColor = "#ffcccc";
	}
	 
}

////////////////////////////////////////////////////////////////// 
// get major Silverlight version 

// Return values: 

// 0 -> Silverlight not installed (at least not properly). 

// 1 -> Silverlight 1 installed 

// 2-> Silverlight 2 installed 

// 3-> Silverlight 3 installed 

////////////////////////////////////////////////////////////////// 




getSilverlightVersion = function() { 
var SLVersion; 

try {   

       try {             
			
			var control = new ActiveXObject('AgControl.AgControl'); 

            if (control.IsVersionSupported("5.0"))                 

               SLVersion = 5;             
			else
			
			if (control.IsVersionSupported("4.0"))                 

               SLVersion = 4;             
			else
			
			if (control.IsVersionSupported("3.0"))                 

               SLVersion = 3;             
			else 

            if (control.IsVersionSupported("2.0"))                

               SLVersion = 2;             
			else 

               SLVersion = 1;            

			//alert('silverlight version=' + SLVersion);
            control = null;       
		} 

      catch (e) {       

                     var plugin = navigator.plugins["Silverlight Plug-In"]; 
                     if (plugin) 

                     {          

                       if (plugin.description === "1.0.30226.2")              

                          SLVersion = 2;                        
						else 

                          SLVersion = parseInt(plugin.description[0]); 
                      } 

                      else 

                         SLVersion = 0; 
      } 

} 

catch (e) {  

      SLVersion = 0; } 

return SLVersion; 

} 


