// Cycle Through Thumbnail Issues & Ads
$(document).ready(function() {
    $('.slideshow-issues').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:    600, 
		timeout:  2000
	});
});
$(document).ready(function() {
    $('.slideshow-ads').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed:    2500, 
		timeout:  9000
	});
});

// Opens PopUps
function openDialog1(URL) { 
window.open(URL,"dialog1","height=300,width=390,left=80,top=80,scrollbars=no,menubar=no,resizable=no,location=no,toolbar=no");
}
function openDialog2(URL) { 
window.open(URL,"dialog2","height=600,width=500,left=80,top=80,scrollbars=no,menubar=no,resizable=no,location=no,toolbar=no");
}
function openDialog3(URL) { 
window.open(URL,"dialog3","height=200,width=390,left=80,top=80,scrollbars=no,menubar=no,resizable=no,location=no,toolbar=no");
}
function openWindow(URL,Width,Height,Scrollbars) { 
window.open(URL,"popup","width=" + Width + ",height=" + Height + ",left=20,top=20,scrollbars=" + Scrollbars + ",menubar=no,resizable=no,location=no,toolbar=no");
}
var win= null;
function NewWindow(mypage,myname,w,h,scroll){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='scrollbars='+scroll+',';
	settings +='resizable=no';
	win=window.open(mypage,myname,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}
var win= null;
function NewWindowWithScroll(mypage,myname,w,h,scroll){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='scrollbars='+scroll+',';
	settings +='resizable=no';
	win=window.open(mypage,myname,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}
function MM_openBrWindow(theURL,winName,features) {
	window.open(domain_url,winName,features);
}

function validateContactForm(Contact_Form)
{

	if (!validFullName(Contact_Form.full_name,"First and Last Name",true))
		return false;
	if (!validEmail(Contact_Form.email_address,"E-mail Address",true))
		return false;
	if (!validMessage(Contact_Form.message,"Message"))
		return false;
	
	return true;
}

function validFullName(formField,fieldLabel)
{
	var result = true;
	
	if ((formField.value == "") || (formField.value.length <6 ))
	{
		alert('Please enter a value of 6 characters or more for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	
	return result;
}

function validEmail(formField,fieldLabel,required)
{
	var result = true;
	
	if (required && !validEmail_Required(formField,fieldLabel))
		result = false;

	if (result && ((formField.value.length < 3) || !isEmailAddr(formField.value)) )
	{
		alert("Please enter your correct e-mail address (i.e.) yourname@yourdomain.com");
		formField.focus();
		result = false;
	}
   
  return result;

}

function validEmail_Required(formField,fieldLabel)
{
	var result = true;
	
	if (formField.value == "")
	{
		alert('Please enter a value for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	
	return result;
}

function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function validMessage(formField,fieldLabel)
{
	var result = true;
	
	if ((formField.value == "") || (formField.value.length <5 ) || (formField.value.length >300 ))
	{
		alert('Please enter a minimum value of 5 characters (up to 300 characters) for the "' + fieldLabel +'" field.');
		formField.focus();
		result = false;
	}
	
	return result;
}

function maximize() {
   	window.moveTo(0,0)
   	window.resizeTo(screen.availWidth, screen.availHeight)
}
