// Provided by Barzi eCommerce - Maziar Barzi

//  ********************************************************************
//  ********************************************************************
//  Mail Login Form
function UseridComplete()
{
	if ( logon.miniuserid.value == "" || logon.miniuserid.value == " " )
	{
		logon.miniuserid.focus()
		return false
	}
	if ( logon.minipass.value == "" || logon.minipass.value == " " )
	{
		logon.minipass.focus()
		return false
	}

	clsu = logon.miniuserid.value
	clsp = logon.minipass.value

	logon.oPassID.value = clsp
	logon.oUserID.value = clsu + "@pejman-music.com"

	logon.miniuserid.value = ""
	logon.minipass.value = ""

//	 alert ( logon.oUserID.value + "\n" + logon.oPassID.value )
	return true
}	





//  ********************************************************************
//  ********************************************************************
//  Contact Reset Form
function ContactResetForm(ResetType)
{
	for (i=1;i<=4;i++)
	{
		document.getElementById("Error_"+i).className = "Makhfi"
		frmContact.ErrorMsg.value = ""
	}
	for (i=1;i<=8;i++)
		document.getElementById("Fill_"+i).className = ""
	if (ResetType == 1 )
	{
		frmContact.reset()
		frmContact.FullName.focus()
	}
}





//  ********************************************************************
//  ********************************************************************
//  Contact Validation
function ContactValidation(mode)
{
	ContactResetForm(2)

	if (SP.test(frmContact.FullName.value) == false)
	{
		Error_1.className = "Ashkar"
		Fill_1.className = "Validate"
		Fill_2.className = "Validate"
		frmContact.FullName.focus()
		frmContact.FullName.select()
		return false
	}

	if (mode=="En")
	{
		if (SP.test(frmContact.Email.value) == false)
		{
			frmContact.ErrorMsg.value = "Please enter your email address"
			Fill_3.className = "Validate"
			Fill_4.className = "Validate"
			Error_2.className = "Ashkar"
			frmContact.Email.focus()
			frmContact.Email.select()
			return false
		}
		else
		{
			if ( RE.test(frmContact.Email.value) == false)
			{
				frmContact.ErrorMsg.value = "Invalid your email address"
				Fill_3.className = "Validate"
				Fill_4.className = "Validate"
				Error_2.className = "Ashkar"
				frmContact.Email.focus()
				frmContact.Email.select()
				return false			
			}
		}
	}
	else
	{
		if (SP.test(frmContact.Email.value) == false)
		{
			frmContact.ErrorMsg.value = "لطفا ايميل را وارد نمايئد"
			Fill_3.className = "Validate"
			Fill_4.className = "Validate"
			Error_2.className = "Ashkar"
			frmContact.Email.focus()
			frmContact.Email.select()
			return false
		}
		else
		{
			if ( RE.test(frmContact.Email.value) == false)
			{
				frmContact.ErrorMsg.value = "لطفا ايميل را صحيح وارد نمايئد"
				Fill_3.className = "Validate"
				Fill_4.className = "Validate"
				Error_2.className = "Ashkar"
				frmContact.Email.focus()
				frmContact.Email.select()
				return false			
			}
		}
	}
	

	if (SP.test(frmContact.SubjectMail.value) == false)
	{

		Fill_5.className = "Validate"
		Fill_6.className = "Validate"
		Error_3.className = "Ashkar"
		frmContact.SubjectMail.focus()
		frmContact.SubjectMail.select()
		return false
	}


	if (SP.test(frmContact.Description.value)== false || frmContact.Description.value.length < 10)
	{
		Fill_7.className = "Validate"
		Fill_8.className = "Validate"
		Error_4.className = "Ashkar"
		frmContact.Description.focus()
		frmContact.Description.select()
		return false			
	}

	frmContact.btnSubmit.disabled = true
	frmContact.btnReset.disabled = true
	return true
}





//  ********************************************************************
//  ********************************************************************
//  Block key , Only Number
function BlockKeyNum()
{
	// Numeric Code
	if (event.keyCode < 45 || event.keyCode > 57) 
		event.returnValue = false
	// Enter Code
	if (event.keyCode == 13 )
		event.returnValue = true		
}










//  ********************************************************************
//  ********************************************************************
//  Html Tag for use memo fields in database
function EncryptHtml(theText) {
output = new String;
TextSize = theText.length;
output = ""

for (i = 0; i < TextSize; i++)
{

	CodeMatn = theText.charCodeAt(i) 

	if ( CodeMatn == 13 ) 
		TagHtml = "<p>"
	else
		TagHtml = String.fromCharCode(CodeMatn)

	if ( CodeMatn == 32 )
		rdl = "&nbsp;"

	output = output + TagHtml

}
return output;
}



//  ********************************************************************
//  ********************************************************************
//  Email Validation
RE=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/   // Email Validate
SP=/\S/												 // Check Space 





//  ********************************************************************
//  ********************************************************************
//  Window Map
function OpenWin(pageURL)
{

	conf ='width=800,height=600,scrollbars=yes'
	conf += ',resizable=no'
	poop = window.open (pageURL,"poop",conf)	

}


//  ********************************************************************
//  ********************************************************************
//  Photo Gallery Main Menu

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

function nereidFade(object, destOp, rate, delta)
	{
		if (!document.all)
			return
		if (object != "[object]")
		{  
			setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
			return;
		}
     
		clearTimeout(nereidFadeTimers[object.sourceIndex]);
  
		diff = destOp-object.filters.alpha.opacity;
		direction = 1;
		if (object.filters.alpha.opacity > destOp)
		{
			direction = -1;
		}
   				
		delta=Math.min(direction*diff,delta);
		object.filters.alpha.opacity+=direction*delta;

		if (object.filters.alpha.opacity != destOp)
		{
			nereidFadeObjects[object.sourceIndex]=object;
   				nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
		}
}
