function CompareDates(txtAuctionSDate, txtAuctionEDate, Caption1, Caption2)
 {
	 //alert(txtAuctionSDate.value.length);
	//alert(txtAuctionEDate.value.length);                
	//return false;
 if(txtAuctionSDate.length!=0 && txtAuctionEDate.length!=0 )
	{
	  var StartDate = txtAuctionSDate;
	  var EndDate = txtAuctionEDate;
	 
	  var arrStart = StartDate.split("-");
	  var arrEnd = EndDate.split("-");          
	  
  if(parseInt(arrEnd[2])<parseInt(arrStart[2]))
		{
		 //alert( Caption1 + ' should be less than or equal to ' + Caption2 + '.' );
		  return false; 
		}
  else if(parseInt(arrEnd[2])==parseInt(arrStart[2]))
	{
		if(parseInt(arrEnd[0])<parseInt(arrStart[0]))
		{
				 //alert( Caption1 + '  should be less than or equal to ' + Caption2 + '.' );
				 return false;
		}
	   else if(parseInt(arrEnd[0])==parseInt(arrStart[0]))        
		{
			  if(arrEnd[1]<arrStart[1])
				{
				//alert( Caption1 + ' should be less than or equal to ' + Caption2 + '.' );
				return false;
				}
			  else return true;                        
		 }
		 else return true;
	}		
   else return true;                        
 }
 else
 {
	return true;
 } 
} 

//This function does not allow equality of two dates also.
//For Used In These Fils: ListNewsletter.php.
function CompareDatesEquality(txtAuctionSDate, txtAuctionEDate, Caption1, Caption2)
 {
 //alert(txtAuctionSDate.value.length);
//alert(txtAuctionEDate.value.length);                
//return false;
 
 if(txtAuctionSDate.length!=0 && txtAuctionEDate.length!=0 )
	{
	  var StartDate = txtAuctionSDate;
	  var EndDate = txtAuctionEDate;
	 
	  var arrStart = StartDate.split("-");
	  var arrEnd = EndDate.split("-");          
	  
  if(arrEnd[2]<arrStart[2])
	{
	// alert('You must select a future date.');
	  return false; 
	}
  else if(arrEnd[2]==arrStart[2]) 
	{
		if(parseInt(arrEnd[0])<parseInt(arrStart[0]))
		{
				// alert('You must select a future date.');
				 return false;
		}
	   else if(parseInt(arrEnd[0])==parseInt(arrStart[0]))        
		{
			  if(arrEnd[1]<=arrStart[1])
				{
				//alert('You must select a future date.');
				return false;
				}
			    else return true;
		 }
		 else return true;
	}		
   else return true;                        
 }
 else
 {
	return true;
 } 
} 



function popup(url, name, width, height)
{
	var localwidth=width? width : 600;
	var localHeight=height?height:600;
	var localName=name ? name:'';
	var features = "toolbar=no, resizable=yes, scrollbars=yes width=" + localwidth + ", height=" + localHeight ;
	return window.open(url, name, features);
}

function ImageWindow(imageUrl)
{
	imWindow = window.open("", "tinyWindow", 'toolbar=0,width=550,height=600') 
	html="<html><head><title>Agentplace.com</title><body width=100% height=100%>";
	html+="<style type='text/css'><!--";
	html+=".style1 {BORDER-RIGHT: 1px groove #4EACEC; BORDER-TOP: 1px groove #2F688E; FONT-WEIGHT: bold; FONT-SIZE: 10px; BORDER-LEFT: 1px groove #2F688E; COLOR: #ffffff; BORDER-BOTTOM: 1px groove #4EACEC; FONT-FAMILY: Verdana; BACKGROUND-COLOR: #489FDA}";
	html+="--></style>";
	html+="<table align=center width='100%' height='90%'><tr><td align=center valign=middle>";
	html+="<img src='" + imageUrl + "'>";
	html+="</td></tr></table>";
	html+="<p align=center><input type=button value='Close' onclick='window.close()' class='style1'></p>";
	html+="</body></html>";
	imWindow.document.write(html);
}

function getDateObject(dateString,dateSeperator)
{
	//This function return a date object after accepting 
	//a date string ans dateseparator as arguments
	var curValue=dateString;
	var sepChar=dateSeperator;
	var curPos=0;
	var cDate,cMonth,cYear;

	//extract month portion
	curPos=dateString.indexOf(sepChar);
	cMonth=dateString.substring(0,curPos);
	
	cMonth=cMonth-1;
	
	//extract day portion				
	endPos=dateString.indexOf(sepChar,curPos+1);			
	cDate=dateString.substring(curPos+1,endPos);
	

	//extract year portion				
	curPos=endPos;
	endPos=curPos+5;			
	cYear=curValue.substring(curPos+1,endPos);
	//Create Date Object
	dtObject=new Date(cYear,cMonth,cDate);	
	return dtObject;
}
function GetCurrentDate()
{
		txtStartDate = new Date();
		var CurDay = txtStartDate.getDate();
		var CurMonth = txtStartDate.getMonth() + 1;
		var CurYear = txtStartDate.getFullYear();
		if(CurDay<10)
		{
			CurDay = "0" + CurDay;
		}
				
		if(CurMonth<10)
		{
			CurMonth = "0" + CurMonth;
		}
				
		var CurrentDate = CurMonth + "/" + CurDay + "/" + CurYear;
		return CurrentDate;
}

