
function ajaxFormProcessEffect(id)
{
	$(id)
	.ajaxStart(function(){
		
		$(this).html('processing...')
		$(this).show();
	})
	.ajaxComplete(function(){
		$(this).hide(500);
	});
}


function IsNumeric(sText)
{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }
   
   function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

function dragCal(){
	$("#eventDialog").draggable({revert: true, drag:function(){ $(this).css({opacity: 0.5})}, stop:function(){ $(this).css({opacity: 1})}});
}
function getCalCenter(){
	var pos = $(this).position();
var x = pos.left;
var y = pos.top;
var cenY = y-$("#eventDialog").height()/2 + $(this).height()/2
var cenX = x-$("#eventDialog").width()/2 + $(this).width()/2
$("#eventDialog").css({
 top: cenY,
 left: cenX })
$("#eventDialog").fadeIn()
}




function closeCal(){
	$("#eventDialog").fadeOut()
}


function getQuery(keyValue)
{
	try
	{
	var index =-1
	var _all = window.location.href.toString()
	var _query = window.location.search.substring(1)
	if(_query)	
	{
		var parmas = _query.split("&")
		for(i=0;  i< parmas.length; i++)
		{
			var key = parmas[i]
			
			if((index = key.indexOf("=")) >0)
			{
				var paramKey = key.substring(0, index)
				var paramVal = key.substring(index+1)
				if(paramKey == keyValue)
				{
					return paramVal;
				}
			}
		}
	}else
	return false;
	}catch(e){}
	
	
	
}
function getResultData()
{
	
$.ajax({
    type: "GET",
	url: "/OralHealthMonth/IN/EN/xml/data.xml",
	dataType: "xml",
	success: function(xml) {
 		$(xml).find('clinic').each(function(){ 
			var id= $(this).attr("id");
			var zipcode= $(this).find('zip').text();
			var name= $(this).find('name').text()
			var phone= $(this).find('phone').text()
			var address= $(this).find('address').text()
			$("#result").append("<tr id='"+id+"'><td>"+name+"</td><td>"+phone+"</td><td>"+address+"</td><td>"+zipcode+"</td></tr>")	
		
 		})
	}
});	

}

function getResultDataByZipCode(code)
{
	var i=0;
	$.ajax({
    type: "GET",
	url: "/OralHealthMonth/IN/EN/xml/data.xml",
	dataType: "xml",
	success: function(xml) {
		
 		$(xml).find('clinic').each(function(){ 
			var id= $(this).attr("id");
			var zipcode= $(this).find('zip').text();
			var name= $(this).find('name').text()
			var phone= $(this).find('phone').text()
			var address= $(this).find('address').text()
			if(zipcode.toString().indexOf(code) != -1)
			{
				$("#result").append(
					"<tr id='"+id+"'><td>"+name+"</td><td>"+phone+"</td><td>"+address+"</td><td>"+zipcode+"</td></tr>"
				)
				i++;
			}
		
 		})
		if(i==0)
		{
			$("#result").append(
					"<tr><td colspan =4>There is no result match</td></tr>"
				)
		}
	}
});	
}


function popUpLink_RightToothbrush()
{
	window.open("http://www.colgate.ru/app/Colgate/RU/OC/Products/Toothbrushes/Name.cvsp", "popUpLink_RightToothpaste")
}
function popUpLink_RightMouthwash()
{
	window.open("http://www.colgate.ru/app/Colgate/RU/OC/Products/MouthRinse/Name.cvsp", "popUpLink_RightMouthwash")
}
function popUpLink_RightToothpaste()
{
	window.open("http://www.colgate.ru/app/Colgate/RU/OC/Products/Toothpastes/Name.cvsp", "popUpLink_RightToothpaste")
}
function popUpLink_DentalCheckUp()
{
	top.location.href = "/app/OralHealthMonth/UA/Total/GetFreeDentalCUT/AboutOHM.cvsp";
}
