function LoginError()
{
alert("We could not find your username/password.\n\nContact the administrator.");
window.location = "default.aspx"
}

function pageScrollUp() {
    	top.frames["iContent"].scrollBy(0,-100);
}
function pageScrollDown() {
    	top.frames["iContent"].scrollBy(0,100);
}

function ChangeWinePic(CultivarID, ImageHeight, ImageWidth, WinePicWidth){
//alert("pic.aspx?i=" + CultivarID + "&w=" & WinePicWidth + "&h=" + (ImageHeight / ImageWidth) * WinePicWidth + "&pre=&col=winecultivarid&tbl=winecultivars");
var i;
i = Math.round((ImageHeight / ImageWidth) * WinePicWidth);
window.parent.document.imgWine.src = "pic.aspx?i=" + String(CultivarID) + "&w=" + String(WinePicWidth) + "&h=" + String(i) + "&pre=&col=winecultivarid&tbl=winecultivars"
}

function LoginSuccess(UserName,DateAndTime, refURL) 
{ 
var OK; 
OK = confirm("Successfully logged in as " + UserName + " on " + DateAndTime);

if (OK){
     window.location = "default.aspx?" + refURL;
     }
else
{
	window.location = "default.aspx"
}
}

function SMSProgress()
{
   var ProgressWindow;
   // Display topic in named window.
   ProgressWindow = window.open("SMSProgress.aspx", 
     "Progresswin","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=425,height=250,left=0,top=0");
   // Displays the window on top.
   ProgressWindow.focus();
   
   return true;
}

function EmailProgress()
{
   var ProgressWindow;
   // Display topic in named window.
   ProgressWindow = window.open("emailprogress.aspx", 
     "Progresswin","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=200,left=0,top=0");
   // Displays the window on top.
   ProgressWindow.focus();
   
   return true;
}

function preview(templatetype)
{
   var PreviewWindow;
   // Display topic in named window.
   PreviewWindow = window.open("preview.aspx?templatetype=" + templatetype, 
     "Previewwin","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=500,left=0,top=0");
   // Displays the window on top.
   PreviewWindow.focus();
   
   return true;
}

function previewmain(contentid)
{
   var PreviewWindow;
   // Display topic in named window.
   PreviewWindow = window.open("maincontent.aspx?contentid=" + contentid + "&contactid=0&showback=false", 
     "Previewwin","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=500,left=0,top=0");
   // Displays the window on top.
   PreviewWindow.focus();
   
   return true;
}

function validateCellPhone(objCapture){
	var Mobile = objCapture.value
	if (Mobile ==""){
		return
	}
	else{
	
		if (Mobile.substring(0,3)!="082" && Mobile.substring(0,3)!="083" && Mobile.substring(0,3)!="076" && Mobile.substring(0,3)!="084" && Mobile.substring(0,3)!="072" && Mobile.substring(0,3)!="073" && Mobile.substring(0,3)!="074"){
			alert("Please check Cell phone number - it does not appear to be valid. (082 xxx xxxx)")
			objCapture.focus();
            return false;
		}
	}
}

function ConfirmDeleteContacts() 
{ 
var Delete; 
Delete = confirm('Are you sure you want to permanently delete the selected contact(s)?'); 

if (Delete){
     return true;
     }
else
	{
	return false;
	}
}

function ConfirmDeleteContent() 
{ 
var Delete; 
Delete = confirm('Are you sure you want to permanently delete the selected content?'); 

if (Delete){
     return true;
     }
else
	{
	return false;
	}
}

function TakeAWhile() 
{ 
var AWhile; 
AWhile = confirm('This may take a little while...'); 

if (AWhile){
     return true;
     }
else
	{
	return false;
	}
}

function CheckSMSLength(Target) {;StrLen = Target.value.length;if (StrLen > 160 ) {Target.value = Target.value.substring(0,160);charsLeft = 0;}else {charsLeft = 160 - StrLen;}document.all.objSMS_charsLeft.value = charsLeft;}
