
<!--
	//The first line of your Adsense code holds your publisher id which is unique for each publisher’s. 
	google_ad_client = "pub-3350221585736729"; 
	//	The second line of code (which is just a comment) is used for defining the name of the ad you 
	//defined during ad setup in Google Adsense.
	//google_ad_slot = "3904225124";
	//These two lines of code used to define the width and height of the ads appearing on your website.
	//Skyscraper (120x600)
	google_ad_width = 120; 
	google_ad_height = 600; 
	google_ad_format = "120x600_as"; 
	google_ad_type = "text_image"; 
	google_color_border = "FFFFFF"; 
	google_color_bg = "FFFFFF"; 
	google_color_link = "FFFFFF"; 
	google_color_text = "000000"; 
	google_color_url = "341473"; 
	google_ui_features = "rc:6"; 
	//-->

//this function all leading and trailing spaces
//from string.

function PostWebRequest(clickType,compid)
{
    var wRequest = new Sys.Net.WebRequest();
    wRequest.set_url("../ServiceUI.aspx?clickType=" + clickType + "&compId=" + compid);
    wRequest.set_httpVerb("POST");
    wRequest.invoke();              
}



function trim(String)
{
	return String.replace(/^\s/g,"").replace(/\s$/g,"");
}

// ---- Functions for List List Control on Admin screens ---- //
//this function removes values from the source control
//and adds them to the target control
function AddSelectedValues(source, target)
{
	var nCounter = 0;
	var SelectedIndices = new Array();	//persist the selected values in the source control and remove them once they've been added to the target
	var SelectedOption;					//Option control, used to insert a new value into the listbox
	var bResult = false;
	
	//loop through all the values in the source box and remove them
	for (i=0; i<source.options.length; i++)
	{
		if (source.options[i].selected==true)
		{
			//add them to the target box
			SelectedOption = new Option(source.options[i].text, source.options[i].value)
			target.options[target.options.length] = SelectedOption					
			
			//add the selected value to the indices array so it can be removed from the source
			SelectedIndices[nCounter] = i;
			nCounter += 1;
			
			if(source.options[i].text == 'Anonymous')
			{
				bResult = true;
			}
		}
	}
	
	//remove the selected options from the source listbox
	RemoveValues(source, SelectedIndices)
	
	//reset the selection on the source listbox
	source.selectedIndex = -1
	
	return bResult;
}


//retrieves all values in the source listbox and adds them into the target listbox.
//subsequently, all values in the source listbox are removed.
function AddAllValues(source, target)
{
	var nCounter = 0;
	var SelectedIndices = new Array();	//persist the selected values in the source control and remove them once they've been added to the target
	var SelectedOption;
	
	//loop through all the values in the source box and remove them
	for (i=0; i<source.options.length; i++)
	{
		//add them to the target box
		SelectedOption = new Option(source.options[i].text, source.options[i].value)
		target.options[target.options.length] = SelectedOption					
		
		//add the selected value to the indices array so it can be removed from the source
		SelectedIndices[nCounter] = i;
		nCounter += 1;			
	}
	
	//remove the selected options from the source listbox
	RemoveValues(source, SelectedIndices)
	
	//reset the selection on the source listbox
	source.selectedIndex = -1
	
}	

//this function removes all values in the specified HTML control, based on the 
//array of indices sent as the input parameter.
function RemoveValues(control, Indices)
{
	//this loop moves backwards so as to avoid a conflict in the index number within the list box.
	for(i=Indices.length-1; i>=0; i--)
	{
		//remove the value at the index
		control.options[Indices[i]] = null;
	}
}

function MoveUp(source)
{
	var nCounter = 0;
	var SelectedIndices = new Array();	//persist the selected values in the source control and remove them once they've been added to the target
	var SelectedOption;					//Option control, used to insert a new value into the listbox
	var nSelectedOption;
	
	//loop through all the values in the source box and remove them
	for (i=0; i<source.options.length; i++)
	{
		if (source.options[i].selected==true)
		{
			SelectedIndices[nCounter] = source.options[i];
			nSelectedOption = i;
			nCounter = nCounter + 1;
		}
	}
	
	if(SelectedIndices.length > 1)
	{
		alert('Please select one value at a time.');
	}
	else if(SelectedIndices.length == 1 && nSelectedOption > 0)
	{
		for(i=0; i < SelectedIndices.length; i++)
		{
			SelectedOption = source.options[nSelectedOption - 1];
			source.options[nSelectedOption] = new Option(SelectedOption.text, SelectedOption.value);
			source.options[nSelectedOption - 1] = new Option(SelectedIndices[i].text, SelectedIndices[i].value);
			source.options[nSelectedOption - 1].selected = true;
		}
	}
}


function MoveDown(source)
{
	var nCounter = 0;
	var SelectedIndices = new Array();	//persist the selected values in the source control and remove them once they've been added to the target
	var SelectedOption;					//Option control, used to insert a new value into the listbox
	var nSelectedOption;
	
	//loop through all the values in the source box and remove them
	for (i=0; i<source.options.length; i++)
	{
		if (source.options[i].selected==true)
		{
			SelectedIndices[nCounter] = source.options[i];
			nSelectedOption = i;
			nCounter = nCounter + 1;
		}
	}
	
	if(SelectedIndices.length > 1)
	{
		alert('Please select one value at a time.');
	}
	else if(SelectedIndices.length == 1 && nSelectedOption < source.options.length - 1)
	{
		for(i=0; i < SelectedIndices.length; i++)
		{
			SelectedOption = source.options[nSelectedOption + 1];
			source.options[nSelectedOption] = new Option(SelectedOption.text, SelectedOption.value);
			source.options[nSelectedOption + 1] = new Option(SelectedIndices[i].text, SelectedIndices[i].value);
			source.options[nSelectedOption + 1].selected = true;
		}
	}
}

function StoreSelectedIDs(listctrl, hiddenctrl)
{
	//clear the contents of the hidden control
	hiddenctrl.value = "";

	//loop through the list control and populate the value in the hidden field
	for (i=0; i<listctrl.options.length; i++)
	{
		hiddenctrl.value = hiddenctrl.value + listctrl.options[i].value + ","
	}
	
	hiddenctrl.value = hiddenctrl.value.replace(/,$/g, "");
}
// ---- END Functions for List List Control ---- //

function updatePageHeading(PageHeading)
{
	window.top.document.getElementById('lblHeader').style.display = '';
	window.top.document.getElementById('lblHeader').innerText = PageHeading;
}

function AbrirModal(pagina, titulo)
{
    controles = new Array();
    for (var i = 2; i < arguments.length; i++ )
    {
        controles[i-2] = arguments[i];
    }
    pagina2 = pagina.replace("?", "|");
    pagina2 = pagina2.replace("&", "$");
    window.showModalDialog("../UI/Popup.aspx?page=" + pagina2 + "&title=" + titulo, window, "status:no;dialogWidth:700px;dialogHeight:600px;center:10;help:no;resizable:yes");
}

function Layout()
	{
		//debugger;
		if (document.getElementById('tbl1') != null)
		{
		    var ar = document.getElementById('tbl1').offsetHeight;
		    var number = 0;
		    if (document.getElementById('ctlContentView_trContentView')!= null)
		    {
		        number = document.getElementById('ctlTree_Tablect1').offsetHeight - document.getElementById('ctlContentView_trContentView').offsetHeight - document.getElementById('trDefault').offsetHeight - document.getElementById('ctlContentView_tdPageDescription').offsetHeight;
		    }
		    else
		    {
		        number = document.getElementById('ctl00_ContentPlaceHolder1_ctlTree_Tablect1').offsetHeight - document.getElementById('ctl00_trDefault').offsetHeight - document.getElementById('ctl00_ContentPlaceHolder1_ctlContentView_tdPageDescription').offsetHeight;
		    }
		      
		    if(number<0)
		    {
			    number = number * -1;
		    }
		    else if(number > 100)
		    {
			    document.getElementById('ctl00_ContentPlaceHolder1_ctlContentView_displayed').style.height= number + "px"; 
		    }
		}				
	}

/*Script added by Ajay on 08-12-08 */////////////////
	
	
	  function getBody(content) 
		{
		test = content.toLowerCase();    // to eliminate case sensitivity
		var x = test.indexOf("<body");
		if(x == -1) return "";

		x = test.indexOf(">", x);
		if(x == -1) return "";

		var y = test.lastIndexOf("</body>");
		if(y == -1) y = test.lastIndexOf("</html>");
		if(y == -1) y = content.length;    // If no HTML then just grab everything till end

		return content.slice(x + 1, y);   
		} 

/**
	Loads a HTML page
	Put the content of the body tag into the current page.
	Arguments:
		url of the other HTML page to load
		id of the tag that has to hold the content
*/		

		function loadHTML(url, fun, storage, param)
		{
			debugger;
			var xhr;
			var str;
			if(window.XMLHttpRequest) xhr = new XMLHttpRequest();
			else if(window.ActiveXObject) xhr = new ActiveXObject("Microsoft.XMLHTTP");
			if(xhr==null) return;
			xhr.onreadystatechange=function()
			{ 
				if(xhr.readyState == 4)
				{
					if(xhr.status == 200)
					{
						if(storage!=null)
						{
						   // debugger;
						    str = getBody(xhr.responseText);
							storage.innerHTML = str;
							//fun(storage, param);
							//Layout();
							FindMlinkOnPageLoad();
							//__dopostback();
													}
						
					}
				} 
			}; 

			xhr.open("GET", url , true);
			xhr.send(null); 

		} 

	/**
		Callback
		Assign directly a tag
	*/		


			function processHTML(temp, target)
			{
				target.innerHTML = temp.innerHTML;
			}

			function loadWholePage(url)
			{
				//debugger;
				alert (url);
				var y = document.getElementById("ctlContentView_storage");
				var x = document.getElementById("ctlContentView_displayed");
				loadHTML(url, processHTML, x, y);
			}	


	/**
		Create responseHTML
		for acces by DOM's methods
	*/	
	
		function processByDOM(responseHTML, target)
		{
			target.innerHTML = "Extracted by id:<br />";

			var message = responseHTML.getElementsByTagName("div").namedItem("two").innerHTML;
			target.innerHTML += message;

			target.innerHTML += "<br />Extracted by name:<br />";
			
			message = responseHTML.getElementsByTagName("form").namedItem("ajax");
			target.innerHTML += message.dyn.value;
		}
		
		function accessByDOM(url)
		{
			//var responseHTML = document.createElement("body");	// Bad for opera
			var responseHTML = document.getElementById("storage");
			var y = document.getElementById("displayed");
			loadHTML(url, processByDOM, responseHTML, y);
		}
	function FindMlinkOnPageLoad()
		{
			var mlink = document.getElementById('MoreLink');
			if (mlink!=null)
			{
				hide(mlink);
		    }
		    Layout();
   	    }
    	
    	function hide(mlink)
		{
			//alert("Hi");
			if (document.all)
			{ //IS IE 4 or 5 or later
				mlink.innerText=' ';
				//alert("IE");
			}
			//IS NETSCAPE 4 or below
			if (document.layers)
			{
				mlink.innerText=' ';
			//alert(”NETSCAPE 4 or below”);
			}
			//Mozilla/Netscape6+ and all the other Gecko-based browsers
			if (document.getElementById &&!document.all)
			{
				mlink.firstChild.nodeValue=' ';
				//alert("Mozilla");
			}
		}
		
		
	function validateEmail(id) {
       var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;       
       var address = document.getElementById(id).value;      
      
       if(reg.test(address) == false) {
          alert('Invalid Email Address');
          return false;
          }
         
   }
   
   
   
   
   
   
   
//   var resultElement;

//function pageLoad()
//{
//    resultElement = $get("ResultId");
//}

// This function performs a GET Web request.
//function GetWebRequest()
//{
//    alert("Performing Get Web request.");

//    // Instantiate a WebRequest.
//    var wRequest = new Sys.Net.WebRequest();
//    
//    // Set the request URL.      
//    wRequest.set_url("getTarget.htm");
//    alert("Target Url: getTarget.htm");

//    // Set the request verb.
//    wRequest.set_httpVerb("GET");
//           
//    // Set the request callback function.
//    wRequest.add_completed(OnWebRequestCompleted);
// 
//    // Clear the results area.
//    resultElement.innerHTML = "";

//    // Execute the request.
//    wRequest.invoke();  
//}

// This function performs a POST Web request.
//function PostWebR(clickType,compid)
//{
//    //alert("Performing Post Web request.");
//    
//    // Instantiate a WebRequest.
//    var wRequest = new Sys.Net.WebRequest();
//    
//    // Set the request URL.      
//    wRequest.set_url("../ServiceUI.aspx?clickType=" + clickType + "&compId=" + compid);
//   // alert("Target Url: MailExample.aspx");

//    // Set the request verb.
//    wRequest.set_httpVerb("POST");
//   
//    // Set the request handler.
//    wRequest.add_completed(OnWebRequestCompleted);
// 
//    // Execute the request.
//    wRequest.invoke();              
//     
//   
//}
// This callback function processes the 
// request return values. It is called asynchronously 
// by the current executor.
//function OnWebRequestCompleted(executor, eventArgs) 
//{   

//    if(executor.get_responseAvailable()) 
//    {
//        // Clear the previous results. 
//       
////       resultElement.innerHTML = "";
//   
//        // Display Web request status. 
////       resultElement.innerHTML +=
////          "Status: [" + executor.get_statusCode() + " " + 
////                    executor.get_statusText() + "]" + "<br/>";
////        
////        // Display Web request headers.
////       resultElement.innerHTML += 
////            "Headers: ";
////            
////       resultElement.innerHTML += 
////            executor.getAllResponseHeaders() + "<br/>";

////        // Display Web request body.
////       resultElement.innerHTML += 
////            "Body:";
//           
////      if(document.all)
////        resultElement.innerText += 
////           executor.get_responseData();
////      else
////        resultElement.textContent += 
////           executor.get_responseData();
//    }

//}






if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
