reg_email=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9._-]+\.)+[a-zA-Z0-9.-]{2,4}$/;

function isValidDate(yyyy,mm,dd)
{
	small_months="04|06|09|11";
	if(small_months.indexOf(mm)>-1 && dd>30)
	{
		return false;
	}
	if(mm=="02")
	{
		if((((yyyy % 4==0)&&(yyyy % 100!=0))||(yyyy % 400==0)))
		{
			if(dd>29)
			{
				return false;
			}
		}
		else
		{
			if(dd>28)
			{
				return false;
			}
		}
	}
	return true;
}

function resizeImage(img)
{
	var zoom=(parseInt(img.style.zoom,10)||100);
	zoom+=event.wheelDelta/12;
	if (zoom>0)
	{
		img.style.zoom=zoom+'%';
	}
	return false;
}

function restoreImage(img)
{
	img.style.zoom="100%";
}

function isIE()
{
	return (navigator.appName=="Microsoft Internet Explorer");
}

function correctPNG() 
{
  for(var i=0;i<document.images.length;i++)
	{
	  var img=document.images[i];
	  var LW=img.width;
	  var LH=img.height;
	  var imgName=img.src.toUpperCase();
	  if (imgName.substring(imgName.length-3,imgName.length)=="PNG")
	  { 
			img.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+img.src+", sizingmethod=scale);"; 
			img.src="images/transparent.png";
			img.width=LW;
			img.height=LH;
	  }
  }
}

function ajax(div_id,URL,doSth)
{
 
	var http_request = false;
	document.getElementById(div_id).innerHTML=_MSG_LOADING;
  if (window.XMLHttpRequest)
	{
		http_request = new XMLHttpRequest();
	} 
	else if (window.ActiveXObject)
	{
		try
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
			}
		}
	}
	if(!http_request)
	{
		 alert("Can not create XMLHTTP instance");
		 return false;
	}
	
	http_request.onreadystatechange = function()
	{
		if(http_request.readyState == 4)
		{
			if(http_request.status == 200)
			{
				document.getElementById(div_id).innerHTML=http_request.responseText;          
				if(isIE())
				{
					correctPNG();
				}
			}
			else
			{
				alert("There was a problem with the request. Error code:"+http_request.status);
				return;
			}
		}
  }
	URL=URL.replace(/(&+)misc=([0-9])+/g,'');
	URL=URL+((URL.indexOf('?')>-1)?'&':'?')+"misc="+(new Date()).getTime();
	http_request.open("GET",URL,true);
	http_request.send(null);
	if(doSth!=null)
	{
		eval(doSth+" ;");
	}
	if(isIE())
	{
		correctPNG();
	}
}

function indexOfArray(arrayname,forsearch)
{
	for(var s=0;s < arrayname.length ;s++)
	{
		if(arrayname[s]==forsearch)
			return s;
	}
	return -1;
}

function getEvent(event)
{
  return (window.event!=null)?window.event:event;
}

function timeDiff(time1,time2)
{
	return Date.parse(time1.toString())-Date.parse(time2.toString());
}

