
/* ARIZONA WEDDING FLOWER JS */


/* COMMON */
function Validate_EmailAddress()
{
	if (document.getElementById("EmailAddress").value=="")
	{
		alert("Please Enter Your Email Address");
		document.getElementById("EmailAddress").focus();
		return false;
	}

	if (document.getElementById("EmailAddress").value != "")
	{
		var strEmail = document.getElementById("EmailAddress").value;
		if (strEmail.indexOf("@") <= 0 || strEmail.indexOf("@") == strEmail.length ||
			strEmail.indexOf("@",(strEmail.indexOf("@")+1))!=-1 ||
			strEmail.indexOf(".") <= 0 || strEmail.indexOf(".") == strEmail.length ||
			strEmail.indexOf(".",(strEmail.indexOf("@")+2))==-1 ||
			strEmail.substring(strEmail.indexOf("@")-1,strEmail.indexOf("@"))=="." ||
			strEmail.substring(strEmail.indexOf("@")+1,strEmail.indexOf("@")+2)=="." ||
			strEmail.indexOf(" ") != -1)
		{
			alert("Please Enter A Valid Email Address\nExample: YourName@YourEmail.com");
			document.getElementById("EmailAddress").focus();
			return false;
		}
	}
	return true;
}


/* PORTFOLIO */
function PageLoad_PORTFOLIO(img,w,h)
{
	loadImages();
	SPAN_Style_none();
	document.getElementById("span_main_frame").style.display = 'block';
	document.getElementById("category_1").style.display = 'block';
	document.getElementById("span_main_image").innerHTML = '<img style="cursor:pointer;width:' + w + ';height:' + h + ';" onClick=\'OnImageItemClick("../Images/' + img + '")\' src="../Images/' + img + '" />';
}

function OnImageItemMouseOver(e,img,w,h)
{
	
	for(var i=0;i<document.getElementsByTagName('td').length;i++)
		{document.getElementsByTagName("td")[i].className='ImageItemOff';}
	
	document.getElementById("span_main_image").innerHTML = '<img style="cursor:pointer;width:' + w + ';height:' + h + ';" onClick=\'OnImageItemClick("../Images/' + img + '")\' src="../Images/' + img + '" />';
	e.className='ImageItemOn';
}

function OnImageItemClick(c)
{
	newwindow=window.open('../Images/' + c,'Image','left=100,top=100,width=500,height=500,menubar=0;toolbar=0,location=0,resizable=1');
	if (window.focus) {newwindow.focus();}
}

function SPAN_Style_block(span)
{
	SPAN_Style_none();
	document.getElementById(span).style.display = 'block';
	return;
}

function SPAN_Style_none()
{
	document.getElementById("category_1").style.display = 'none';
	document.getElementById("category_2").style.display = 'none';
	document.getElementById("category_3").style.display = 'none';
	document.getElementById("category_4").style.display = 'none';
	document.getElementById("category_5").style.display = 'none';
}

function loadImages() {
if (document.getElementById) {  // DOM3 = IE5, NS6
document.getElementById('hidepage').style.visibility = 'hidden';
}
else {
if (document.layers) {  // Netscape 4
document.hidepage.visibility = 'hidden';
}
else {  // IE 4
document.all.hidepage.style.visibility = 'hidden';
      }
   }
}


var scrolling = null;
function scroll_up() {
    var d = document.getElementById('scroller');
    d.scrollTop = d.scrollTop - 4;
    scrolling = window.setTimeout(function() {scroll_up();}, 25);
}
function scroll_down() {
    var d = document.getElementById('scroller');
    d.scrollTop = d.scrollTop + 4;
    scrolling = window.setTimeout(function() {scroll_down();}, 25);
}
function scroll_stop() {
    window.clearTimeout(scrolling);
}
function scroll_left() {
    var d = document.getElementById('scroller');
    d.scrollLeft = d.scrollLeft - 5;
    scrolling = window.setTimeout(function() {scroll_left();}, 4);
}
function scroll_right() {
    var d = document.getElementById('scroller');
    d.scrollLeft = d.scrollLeft + 5;
    scrolling = window.setTimeout(function() {scroll_right();}, 4);
}
function scroll_stop() {
    window.clearTimeout(scrolling);
}


/* MENU */
function OnMenuItemClick(e,c)
{
	for(var i=0;i<document.getElementsByTagName('td').length;i++)
		{document.getElementsByTagName("td")[i].className='MenuItemOff';}
	e.className='MenuItemClicked';
	window.location = "http://www.PinkPetalShop.com/Pages/" + c;
}


/* CONTACTUS */
function Validate_frmSendEmail()
{
	if (document.getElementById("ContactUsReason").value=="")
	{
		alert("Please Select A Reason For Your Inquiry.");
		document.getElementById("ContactUsReason").focus();
		return false;
	}

	if (document.getElementById("ContactUsText").value=="" ||
		document.getElementById("ContactUsText").value=="Please Enter Your Text Here")
	{
		alert("Oops... There doesn't appear to be a question.");
		document.getElementById("ContactUsText").focus();
		return false;
	}

	if (Validate_EmailAddress()==false)
	{return false;}else{return true;}
}


/* USER */
function PageLoad_USER()
{
	try{document.getElementById("EmailAddress").focus();}catch(e){}
}

function li()
{
	if (document.getElementById("EmailAddress").value=="")
	{
		alert("Please enter your Email Address");
		document.getElementById("EmailAddress").focus();
		return false;
	}
	if (document.getElementById("pw").value=="")
	{
		alert("Please enter your Password");
		document.getElementById("pw").focus();
		return false;
	}
	document.getElementById("login_submitted").value=("yes");
}

function fp()
{
	if (document.getElementById("EmailAddress").value=="")
	{
		alert("Please enter your Email Address");
		document.getElementById("EmailAddress").focus();
		return false;
	}
	document.getElementById("forgotpassword_submitted").value=("yes");
}

function rp()
{
	if (document.getElementById("NewPassword").value=="")
	{
		alert("Please reset your password");
		document.getElementById("NewPassword").focus();
		return false;
	}

	if (document.getElementById("NewPassword").value.length < 8)
	{
		alert("New Password must be at least 8 characters");
		document.getElementById("NewPassword").focus();
		return false;
	}

	if (document.getElementById("NewPassword").value!=document.getElementById("NewPasswordConfirm").value)
	{
		alert("New Passwords do not match");
		document.getElementById("NewPassword").focus();
		return false;
	}
	document.getElementById("resetpassword_submitted").value="yes";
}

function ca()
{
	document.getElementById("createaccount_submitted").value=("yes");
}

function sa(rp)
{
	if (document.getElementById("Title").value=="")
	{
		alert("Please select a title");
		document.getElementById("Title").focus();
		return false;
	}

	if (document.getElementById("FirstName").value=="")
	{
		alert("Please enter your First Name");
		document.getElementById("FirstName").focus();
		return false;
	}

	if (document.getElementById("LastName").value=="")
	{
		alert("Please enter your Last Name");
		document.getElementById("LastName").focus();
		return false;
	}

	if (Validate_EmailAddress()==false){return false;}

	if (document.getElementById("EmailAddressConfirm").value=="")
	{
		alert("Please confirm your Email Address");
		document.getElementById("EmailAddressConfirm").focus();
		return false;
	}

	if (document.getElementById("EmailAddress").value!=document.getElementById("EmailAddressConfirm").value)
	{
		alert("Email Addresses do not match");
		document.getElementById("EmailAddress").focus();
		return false;
	}

	if (isNaN(parseInt(document.getElementById("Phone").value)))
	{
		alert("Please only enter Numbers\nExample: 4806840516");
		document.getElementById("Phone").focus();
		return false;
	}

	if (rp=="y" && document.getElementById("NewPassword").value=="")
	{
		alert("Please create a Password");
		document.getElementById("NewPassword").focus();
		return false;
	}

	if (document.getElementById("NewPassword").value!="")
	{
		if (document.getElementById("NewPassword").value.length < 8)
		{
			alert("Password must be at least 8 characters");
			document.getElementById("NewPassword").focus();
			return false;
		}

		if (document.getElementById("NewPasswordConfirm").value=="")
		{
			alert("Please confirm your password");
			document.getElementById("NewPasswordConfirm").focus();
			return false;
		}

		if (document.getElementById("NewPassword").value!=document.getElementById("NewPasswordConfirm").value)
		{
			alert("Passwords do not match");
			document.getElementById("NewPassword").focus();
			return false;
		}
	}

	try{document.getElementById("saveaccount_submitted").value="yes";}catch(e){}
	return true;
}

function selectIndex(strFORMfield,strDBfield)
{
	try
	{
		for(var i = 0; i < document.getElementById(strFORMfield).options.length; i++)
		{
			if (document.getElementById(strFORMfield).options[i].value == strDBfield)
			{
				document.getElementById(strFORMfield).selectedIndex=i;
			}
		}
	}
	catch(e){}
}

/* ARIZONA WEDDING FLOWER JS */
