//		if (checkrequired(frm) == false) return false;
//		if (verifyMail(objMail) == false) return false;
//		if (checkbody(frm,"CONTENT")== false) return false;
//		if(Imageval(frm.photo)==false) return false  ;
//		if(Pdfval(frm.requiredpdf)==false) return false  ;
//		if (chkSelectedRecord(frm) == false ) return false ;
//		if(ValidateDate(frm.month.value+'/'+frm.day.value+'/'+frm.year.value)== false ) return false ;
//-------------------------------------------------
// JavaScript Document

//Create a boolean variable to check for a valid IE instance.
var xmlhttp = false;
//Check if we are using IE.
try {
//If the javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using IE.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
//If we are using a non-IE browser, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}

//Create a boolean variable to check for a valid IE instance.
var xmlhttp2 = false;
//Check if we are using IE.
try {
//If the javascript version is greater than 5.
xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using IE.
xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp2 = false;
}
}
//If we are using a non-IE browser, create a JavaScript instance of the object.
if (!xmlhttp2 && typeof XMLHttpRequest != 'undefined') {
xmlhttp2 = new XMLHttpRequest();

}

//-------------------------------------------------

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-------------------------------------------------------------------------

	function checkPassword(frm)
	{
		if (checkrequired(frm) == false) return false;
		if (frm.requirednewpassword.value !=  frm.requiredconfirmpassword.value)
		{
				alert("Password Mismatch.") ;
				frm.requiredconfirmpassword.focus() ;
				return false ;
		}
		return true ;
	}
//-------------------------------------------------

function checkEditor()
{
	javascript: var oEditor = FCKeditorAPI.GetInstance('MyEditor');
	var content = oEditor.GetXHTML(true)
	
	content = content.replace(/<[^>]*>/g,'') ;
	content = content.replace(/&nbsp;*/g,' ') ;
	content = trim(content, ' ') ;
	return (countWords(trim(content)));
}

//-------------------------------------------------------------
	function SetBgColor(obj)
	{
			obj.style.backgroundColor='#DDDDDD' ;
	}
//---------------------------------------
	function SetDefaultBbColor(obj)
	{
			obj.style.backgroundColor='#FFFFFF' ;
	}
//-------------------------------------------------

	function SetDefaultBbColorUSER(obj)
	{
			obj.style.backgroundColor='#FFFFFF' ;
	}
//-------------------------------------------------

	function checkRank(frm)
	{
		if (Arraycheckrequired(frm) == false ) return false ;
		return true ;
	}
//-------------------------------------------------

//-------------------------------------------------

function PhoneFormat(obj)
{
	var re= /\D/;
	// test for this format: (xxx)xxx-xxxx
	var re2 = /^\({1}\d{3}\)\d{3}-\d{4}/; 
	// test for this format: xxx-xxx-xxxx
	//var re2 = /^\d{3}-\d{3}-\d{4}/;
	
	for (i=0; i<obj.value.length;i++){
	var num=obj.value;
	
	var newNum;
	 if (num != "" && re2.test(num)!=true){
	   if (num != ""){
		 while (re.test(num)){
		 num = num.replace(re,"");
		 }
	   }
	
	  if (num.length != 10){
		alert('Please enter a 10 digit phone number');
		obj.select();
		break;
		}
	   else {
		 // for format (xxx)xxx-xxxx
		// newNum = '(' + num.substring(0,3) + ')' + num.substring(3,6) + '-' + num.substring(6,10);
		 // for format xxx-xxx-xxxx
		  newNum = num.substring(0,3) + '-' + num.substring(3,6) + '-' + num.substring(6,10);
		 obj.value=newNum;
		 }
	   }
	  }
}
//-------------------------------------------------
	function checkLogin(which)
	{
//		if (verifyMail(which.requiredEmail) == false) return false;
		if (checkrequired(which) == false) return false;
		return true;		
	}
//-------------------------------------------------
	function SetCombo(theDayElement,mt)
	{
		var optionCounter;
		for (optionCounter = 0; optionCounter < theDayElement.length;optionCounter++)
		{
		  if(theDayElement.options[optionCounter].value == mt)
		  {
			  theDayElement.options[optionCounter].selected = true
		  }
		}
	}
//-------------------------------------------------
	function winOpenNew(str,Name,Resize,Width,Height,Left,Top)
	{
		window.open(str,Name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable='+Resize+',width='+Width+',height='+Height+',left='+Left+',top='+Top)
	}
//-------------------------------------------------
	function chkAll(form)
	{
		len = form.elements.length;
		var i=0;
		Checked=false ;
		for( i=0 ; i<len ; i++)
		{
			if (form.elements[i].type=='checkbox')
			{
				form.elements[i].checked=true;
			}
		}
		return false ;
	}
//---------------------------------------------------
	function UnchkAll(form)
	{
		len = form.elements.length;
		var i=0;
		Checked=false ;
		for( i=0 ; i<len ; i++)
		{
			if (form.elements[i].type=='checkbox')
			{
				form.elements[i].checked=false;
			}
		}
		return false ;
	}
//---------------------------------------------------
	function SelectOption(frm,obj)
	{
		len = frm.elements[obj].length;
		i = 0;
		
		while (i < len)
		{
			frm.elements[obj][i].selected = 'true' ;
			i++;
		}
	}
//---------------------------------------------------
	function DeleteCheck() 
	{
		var Verify=confirm("Are you sure you want to delete this record and all related records?");
		if (Verify == true)
		{
			return true;			
		}
		else {
			return false;			
		}
	}
//-----------------------------------------


function Arraycheckrequired(which) 
{ 
	var pass=true; 
	if (document.images) 
	{ 
		for (i=0;i<which.length;i++) 
		{ 
			var tempobj=which.elements[i]; 
			if (tempobj.name.substring(0,8)=="required") 
			{ 

				if ((tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password" ||tempobj.type.toString().charAt(0)=="s")&&			tempobj.value=='')
				{ 
					if(tempobj.disabled==false)
					{
						pass=false; 
						break; 
					}
				} 
			} 
		} 
	} 
	if (!pass) 
	{ 
		shortFieldName=tempobj.name.substring(8,30).toUpperCase(); 
		idStartPos=tempobj.name.indexOf("-") ;
		shortFieldName=tempobj.name.substring(8,idStartPos).toUpperCase(); 
		
		alert("Please make sure the "+shortFieldName+" field was properly completed."); 
		tempobj.focus() ;						
		return false; 
				
	} else 
	
	return true; 
			
} 	
//--------------------------------------------------------
	function ImageDeleteCheck() 
	{
		var Verify=confirm("Are you sure you want to delete this  image ?");
		if (Verify == true)
		{
			return true;			
		}
		else {
			return false;			
		}
	}
//----------------------------------------------------------


//=================================================================================================
	function AdminSendCheck(msgval,msgdata) 
	{
		var Verify=confirm("Are you sure that this " + msgval + " " + msgdata + " has been delivered?");
		if (Verify == true)
			return true;			
		else
			return false;			
	}
//-------------------------------------------------
	function PDFDeleteCheck() 
	{
		var Verify=confirm("Are you sure you want to delete this  file ?");
		if (Verify == true)
		{
			return true;			
		}
		else {
			return false;			
		}
	}
//-------------------------------------------------
	function checkGallery(frm)
	{	
		if (checkrequired(frm) == false) return false;
		if (frm.frmaction.value == 'new')
		{
			if(frm.Image.value != '')
			{
				if(Imageval(frm.Image)==false) return false  ;
			}
			else //if(frm.Image.value != '')
			{
				alert('Please make sure that IMAGE field was properly completed.') ;
				return false ;
			}//else //if(frm.Image.value != '')
			
		} //if (frm.frmaction.value == 'new')
		else	
		{
			if(frm.Image.value != '')
			{
				if(Imageval(frm.Image)==false) return false  ;
			}
			
		} //if (frm.frmaction.value == 'new')
	
		return true ;
	}
//----------------------------------------------------	
	function checkDateValidation1(objDay,objMonth,objYear, isRequired)
	{
		if (isRequired)
		{
			if(objMonth.value == '' && objDay.value == '' && objYear.value == '')	
			{
				alert('Please make sure that DATE field is property completed.');
				objMonth.focus();
				return false ;
			}
		}
		if(objMonth.value != '' )
		{
			if (objDay.value == '')
			{
				alert('Please make sure that DAY field is property completed.');
				objDay.focus();
				return false ;
			}	// if (objDay.value == '')
			
			if (objYear.value == '')
			{
				alert('Please make sure that YEAR field is property completed.');
				objYear.focus();
				return false ;
			}	// if (objYear.value == '')
		}	// if(objMonth.value != '' )
		else if(objDay.value != '' )
		{
			if (objMonth.value == '')
			{
				alert('Please make sure that MONTH field is property completed.');
				objMonth.focus();
				return false ;
			}	// if (objMonth.value == '')
			
			if (objYear.value == '')
			{
				alert('Please make sure that YEAR field is property completed.');
				objYear.focus();
				return false ;
			}	// if (objYear.value == '')
			
		}	// else if(objDay.value != '' )
		else if(objYear.value != '' )
		{
			if (objMonth.value == '')
			{
				alert('Please make sure that MONTH field is property completed.');
				objMonth.focus();
				return false ;
			}	// if (objMonth.value == '')
			
			if (objDay.value == '')
			{
				alert('Please make sure that DAY field is property completed.');
				objDay.focus();
				return false ;
			}	// if (objDay.value == '')
		}	// else if(objYear.value != '' )
		
		var _date = objMonth.value + "/" + objDay.value + "/" + objYear.value;
		
		
		if(objMonth.value != '' && objDay.value != '' && objYear.value != '')	
		{
			if(ValidateDate(_date) == false) 
			{
				objMonth.focus();
				return false ;
			}
		}
	
		return true ;
	}
//----------------------------------------------------
	function swapDivDisplay(id1, id2)
	{
		if (document.getElementById(id1) && document.getElementById(id2))
		{
			obj1 = document.getElementById(id1) ;
			obj2 = document.getElementById(id2) ;
			
			if (obj1.style.display == '')
			{
				obj1.style.display = 'none' ;
				obj2.style.display = '' ;
			}
			else
			{
				obj1.style.display = '' ;
				obj2.style.display = 'none' ;
			}
		}
	}	
//----------------------------------------------------
/*
	########################################################
	# JAVASCRIPT FUNCTIONS FOR THE SITE DISNEY PIN WORLD	#
	########################################################
*/

	function checkSeller(frm)
	{
		if (checkrequired(frm) == false) return false;		
		if (frm.requiredPassword.value !=  frm.requiredReTypePassword.value)
		{
				alert("Password Mismatch.") ;
				frm.requiredReTypePassword.focus() ;
				return false ;
		}

		if (frm.requiredEmail.value !=  frm.requiredReTypeEmail.value)
		{
				alert("Email Mismatch.") ;
				frm.requiredReTypeEmail.focus() ;
				return false ;
		}

		if(frm.PhotoFile.value != '')
		{
			if(Imageval(frm.PhotoFile)==false) return false  ;
		}

		//if (VerifyLink(frm.requiredLink) == false) return false;		
		return true ;
	}	// function checkSeller(frm)
//----------------------------------------------------
	function checkProductsEntry(frm)
	{
		if (checkrequired(frm) == false) return false;

/*		if ( !frm.TypeBuyItNow.checked && !frm.TypeAuction.checked )
		{
			alert('Please make sure that TYPE field was properly completed.');
			frm.TypeBuyItNow.focus() ;
			return false ;
		}*/

		//---------------------------------------------------
		if (frm.TypeBuyItNow[1].checked)
		{
			if (getElement('Quantity').value == '' || getElement('Quantity').value == 'Quantity' )
			{
				alert('Please specify the Quantity.') ;
				getElement('Quantity').focus() ;
				return false ;
			}	// if (frm.TypeBuyItNow[1].checked)
		}	// if (frm.TypeBuyItNow[1].checked)


		if (frm.LimitedEdition[0].checked)
		{
			if (getElement('NoOfPins').value == '' || getElement('NoOfPins').value == 'No of Pins' )
			{
				alert('Please specify the No of Pins.') ;
				getElement('NoOfPins').focus() ;
				return false ;
			}
		}

//		alert(getElement('ShipTo2')) ;
//		return false ;
		if (getElement('ShipTo3').checked)
		{
			if (getElement('ShipToOther3').value == '' || getElement('ShipToOther3').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('ShipToOther3').focus() ;
				return false ;
			}
		}


		//if (frm.PaymentMethod[3].checked)
		if (getElement('PaymentMethod4').checked)
		{
			if (getElement('PaymentOther4').value == '' || getElement('PaymentOther4').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('PaymentOther4').focus() ;
				return false ;
			}
		}

		if (frm.PinType[3].checked)
		{
			if (getElement('PinTypeOther4').value == '' || getElement('PinTypeOther4').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('PinTypeOther4').focus() ;
				return false ;
			}
		}


		if (chkSelectedRecordCheckbox(frm, 'Category[]', 'Please make sure that CATEGORY field was proeprty completed.')==false)
		{
			location.href='#category' ;
			return false ;
		}
		
		if(getElement('Category1').checked)	// CATEGORY == "PINS"
		{
			if (checkrequiredRadioMsg(frm.PinType, 'PIN TYPE') == false) 
			{
				frm.PinType[0].focus();
				return false ;
			}	// if (checkrequiredRadioMsg(frm.PinType, 'PIN TYPE') == false) 
		}	// if(getElement('Category1').checked)	// CATEGORY == "PINS"

		if (checkFCKEditorValue('MyEditor', '') == false) return false ;	

		if (chkSelectedRecordCheckbox(frm, 'ShipTo[]', 'Please make sure that SHIP TO field was proeprty completed.')  == false) 
		{
			location.href='#shipto' ;
			return false ;
		}
		
		if (chkSelectedRecordCheckbox(frm, 'PaymentMethod[]', 'Please make sure that PAYMENT METHOD field was proeprty completed.')  == false) 
		{
			location.href='#paymentmethod' ;
			return false ;
		}
		var NoImageUploaded = true ;
		for(imgcount=1;imgcount<=4;imgcount++)
		{
			if(eval('frm.OldImg'+imgcount))
			{
				obj = eval('frm.OldImg'+imgcount);
				if (obj.value != '')
				{
					NoImageUploaded = false ;
					break;
				}
			}
			else
			{

			}
		}	// for(imgcount=1;imgcount<=4;imgcount++)
		
		if (NoImageUploaded)
		{
			alert('Please make sure that PRODUCT IMAGE field was property completed.') ;
//				frm.Image1.focus() ;
			return false ;
		}
		//---------------------------------------
		//Shipping Price/Method 1
		if (!getElement('FreeShipping1').checked)
		{
			if (getElement('ShippingPrice1').value == '' || parseFloat(getElement('ShippingPrice1').value) == 0)
			{
				alert('Please make sure that SHIPPING PRICE 1 field was property completed.') ;
				getElement('ShippingPrice1').focus() ;
				return false ;
			}

			if (frm.TypeBuyItNow[1].checked && parseInt(frm.Quantity.value) > 1 && frm.MultiProductDiscountShipping.checked) // AUCTION TYPE = BUY IT NOW (frm.TypeBuyItNow[1]).
			{
				if (getElement('ForEachPrice1').value == '')
				{
					alert('Please make sure that FOR EACH PRICE 1 field was property completed.') ;
					getElement('ForEachPrice1').focus() ;
					return false ;
				}	// if (getElement('ForEachPrice1').value == '')
			}	//	if (frm.TypeBuyItNow[1].checked && parseInt(frm.Quantity.value) > 1 ) // AUCTION TYPE = BUY IT NOW.
		}	// if (getElement('FreeShipping1').checked)
		if (getElement('ShipMethod1').value == '')
		{
			alert('Please make sure that SHIPPING METHOD 1 field was property completed.') ;
			getElement('ShipMethod1').focus() ;
			return false ;
		}
//		return false ;
		//Shipping Price/Method 2

		if ((getElement('ShippingPrice2').value == '' || parseFloat(getElement('ShippingPrice2').value) == 0) && getElement('ShipMethod2').value != '' && !getElement('FreeShipping2').checked)
		{
			alert('Please make sure that SHIPPING PRICE 2 field was property completed.') ;
			getElement('ShippingPrice2').focus() ;
			return false ;
		}

		if ( (( getElement('ShippingPrice2').value != '' && parseFloat(getElement('ShippingPrice2').value) > 0 ) || getElement('FreeShipping2').checked )&& getElement('ShipMethod2').value == '' )
		{
			alert('Please make sure that SHIPPING METHOD 2 field was property completed.') ;
			getElement('ShipMethod2').focus() ;
			return false ;
		}


		//Shipping Price/Method 3
		if ((getElement('ShippingPrice3').value == '' || parseFloat(getElement('ShippingPrice3').value) == 0) && getElement('ShipMethod3').value != '' && !getElement('FreeShipping3').checked)
		{
			alert('Please make sure that SHIPPING PRICE 3 field was property completed.') ;
			getElement('ShippingPrice3').focus() ;
			return false ;
		}

		if ( ( (  getElement('ShippingPrice3').value != '' && parseFloat(getElement('ShippingPrice3').value) > 0 ) || getElement('FreeShipping3').checked ) && getElement('ShipMethod3').value == '' )  
		{
			alert('Please make sure that SHIPPING METHOD 3 field was property completed.') ;
			getElement('ShipMethod3').focus() ;
			return false ;
		}

		if (frm.frmaction.value == 'new')
		{
			if (frm.SaveAsTemplate.checked && frm.TemplateTitle.value == '')
			{
				alert('Please make sure that TEMPLATE TITLE field was properly completed.');
				return false ;
			}
		}

/*		if(frm.frmaction.value == 'new')	
		{
			if(frm.Image1.value != '')
			{
				if(Imageval(frm.Image1)==false) return false  ;
			}
			else
			{
				alert('Please make sure that PRODUCT IMAGE1 field is property completed.') ;
				frm.Image1.focus() ;
				return false ;
			}
		}
		else
		{
			for(imgcount=1;imgcount<=4;imgcount++)
			{
				obj = eval('frm.Image'+imgcount) ;
				if(obj.value != '')
				{
					if(Imageval(obj)==false) return false  ;
				}
	
			}
			
		}
*/
		return true ;
	}
//----------------------------------------------------
	function checkProductsEntryReRelease(frm)
	{
		if (checkrequired(frm) == false) return false;

/*		if ( !frm.TypeBuyItNow.checked && !frm.TypeAuction.checked )
		{
			alert('Please make sure that TYPE field was properly completed.');
			frm.TypeBuyItNow.focus() ;
			return false ;
		}*/

		//---------------------------------------------------
		if (frm.LimitedEdition[0].checked)
		{
			if (getElement('NoOfPins').value == '' || getElement('NoOfPins').value == 'No of Pins' )
			{
				alert('Please specify the No of Pins.') ;
				getElement('NoOfPins').focus() ;
				return false ;
			}
		}

//		alert(getElement('ShipTo2')) ;
//		return false ;
		if (getElement('ShipTo3').checked)
		{
			if (getElement('ShipToOther3').value == '' || getElement('ShipToOther3').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('ShipToOther3').focus() ;
				return false ;
			}
		}


		//if (frm.PaymentMethod[3].checked)
		if (getElement('PaymentMethod4').checked)
		{
			if (getElement('PaymentOther4').value == '' || getElement('PaymentOther4').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('PaymentOther4').focus() ;
				return false ;
			}
		}

		if (frm.PinType[3].checked)
		{
			if (getElement('PinTypeOther4').value == '' || getElement('PinTypeOther4').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('PinTypeOther4').focus() ;
				return false ;
			}
		}

		if (chkSelectedRecordCheckbox(frm, 'Category[]', 'Please make sure that CATEGORY field was proeprty completed.')==false)
		{
			location.href='#category' ;
			return false ;
		}
		
		if (checkrequiredRadioMsg(frm.PinType, 'PIN TYPE') == false) 
		{
			frm.PinType[0].focus();
			return false ;
		}

		if (checkFCKEditorValue('MyEditor', '') == false) return false ;	

		if (chkSelectedRecordCheckbox(frm, 'ShipTo[]', 'Please make sure that SHIP TO field was proeprty completed.')  == false) 
		{
			location.href='#shipto' ;
			return false ;
		}
		
		if (chkSelectedRecordCheckbox(frm, 'PaymentMethod[]', 'Please make sure that PAYMENT METHOD field was proeprty completed.')  == false) 
		{
			location.href='#paymentmethod' ;
			return false ;
		}
		var NoImageUploaded = true ;
		for(imgcount=1;imgcount<=4;imgcount++)
		{
			if(eval('frm.OldImg'+imgcount))
			{
				obj = eval('frm.OldImg'+imgcount);
				if (obj.value != '')
				{
					NoImageUploaded = false ;
					break;
				}
			}
			else
			{

			}
		}	// for(imgcount=1;imgcount<=4;imgcount++)
		
		if (NoImageUploaded)
		{
			alert('Please make sure that PRODUCT IMAGE field was property completed.') ;
//			frm.Image1.focus() ;
			return false ;
		}
		//---------------------------------------
		//Shipping Price/Method 1
		if (!getElement('FreeShipping1').checked)
		{
			if (getElement('ShippingPrice1').value == '' || parseFloat(getElement('ShippingPrice1').value) == 0)
			{
				alert('Please make sure that SHIPPING PRICE 1 field was property completed.') ;
				getElement('ShippingPrice1').focus() ;
				return false ;
			}

			if (frm.TypeBuyItNow[1].checked && parseInt(frm.Quantity.value) > 1 && frm.MultiProductDiscountShipping.checked) // AUCTION TYPE = BUY IT NOW (frm.TypeBuyItNow[1]).
			{
				if (getElement('ForEachPrice1').value == '')
				{
					alert('Please make sure that FOR EACH PRICE 1 field was property completed.') ;
					getElement('ForEachPrice1').focus() ;
					return false ;
				}	// if (getElement('ForEachPrice1').value == '')
			}	//	if (frm.TypeBuyItNow[1].checked && parseInt(frm.Quantity.value) > 1 ) // AUCTION TYPE = BUY IT NOW.
		}	// if (getElement('FreeShipping1').checked)
		if (getElement('ShipMethod1').value == '')
		{
			alert('Please make sure that SHIPPING METHOD 1 field was property completed.') ;
			getElement('ShipMethod1').focus() ;
			return false ;
		}
//		return false ;
		//Shipping Price/Method 2

		if ((getElement('ShippingPrice2').value == '' || parseFloat(getElement('ShippingPrice2').value) == 0) && getElement('ShipMethod2').value != '' && !getElement('FreeShipping2').checked)
		{
			alert('Please make sure that SHIPPING PRICE 2 field was property completed.') ;
			getElement('ShippingPrice2').focus() ;
			return false ;
		}

		if ( (( getElement('ShippingPrice2').value != '' && parseFloat(getElement('ShippingPrice2').value) > 0 ) || getElement('FreeShipping2').checked )&& getElement('ShipMethod2').value == '' )
		{
			alert('Please make sure that SHIPPING METHOD 2 field was property completed.') ;
			getElement('ShipMethod2').focus() ;
			return false ;
		}


		//Shipping Price/Method 3
		if ((getElement('ShippingPrice3').value == '' || parseFloat(getElement('ShippingPrice3').value) == 0) && getElement('ShipMethod3').value != '' && !getElement('FreeShipping3').checked)
		{
			alert('Please make sure that SHIPPING PRICE 3 field was property completed.') ;
			getElement('ShippingPrice3').focus() ;
			return false ;
		}

		if ( ( (  getElement('ShippingPrice3').value != '' && parseFloat(getElement('ShippingPrice3').value) > 0 ) || getElement('FreeShipping3').checked ) && getElement('ShipMethod3').value == '' )  
		{
			alert('Please make sure that SHIPPING METHOD 3 field was property completed.') ;
			getElement('ShipMethod3').focus() ;
			return false ;
		}



/*
		if(frm.frmaction.value == 'new')	
		{
			if(frm.Image1.value != '')
			{
				if(Imageval(frm.Image1)==false) return false  ;
			}
			else
			{
				alert('Please make sure that PRODUCT IMAGE1 field is property completed.') ;
				frm.Image1.focus() ;
				return false ;
			}
		}
		else
		{
			for(imgcount=1;imgcount<=4;imgcount++)
			{
				obj = eval('frm.Image'+imgcount) ;
				if(obj.value != '')
				{
					if(Imageval(obj)==false) return false  ;
				}
	
			}
			
		}
*/

		var verify = confirm("Re-releasing the item will remove all previous bid history.");
		return verify ;
//		return true ;
	}

//----------------------------------------------------
	function checkTradePinNameEmail(frm)
	{
		if (verifyMail(frm.requiredEmail) == false) return false;
		if (checkrequired(frm) == false) return false;		
	
		return true ;
	}	
//------------------------------------------------------
	function checkSellerRegistrationUser(which)
	{
		if (verifyMail(which.requiredEmail) == false) return false;
				
		if (checkUserName(which.requiredUserName.value) == false) return false;
		if (checkEmail(which.requiredEmail.value) == false) return false;
		
		if (checkrequired(which) == false) return false;
		if (checkFCKEditorValue('MyEditor', '') == false) return false ;

		if(which.requiredPassword.value != "")
		{
			if(which.requiredReTypePassword.value != which.requiredPassword.value)
			{
				alert("Password Mismatch."); 
				which.requiredReTypePassword.focus() ;
				return false ;
			}
		}

		if(which.requiredEmail.value != "")
		{
			if(which.requiredReTypeEmail.value != which.requiredEmail.value)
			{
				alert("Email Mismatch."); 
				which.requiredReTypeEmail.focus() ;
				return false ;
			}
		}


		if(which.WebAddress.value != '')
		{
			if (VerifyLink(which.WebAddress) == false) return false;		
		}
		
		if(which.PhotoFile.value != '')
		{
			if(Imageval(which.PhotoFile)==false) return false  ;
		}
		
/*		objchk =  getElement('ShipToDefault3') ;
	
		if (objchk.checked)
		{
			if (getElement('ShipToOtherSource').value == '' || getElement('ShipToOtherSource').value == 'Please Specify' )
			{
				alert('Please specify the other.') ;
				getElement('ShipToOtherSource').focus() ;
				return false ;
			}
		}

		if (which.PaymentMethod[3].checked)
		{
			if (getElement('OtherSource').value == '' || getElement('OtherSource').value == 'Please Specify' )
			{
				alert('Please specify the other.') ;
				getElement('OtherSource').focus() ;
				return false ;
			}
		}*/

		if(which.seller.value == 1)
		{
			if (getElement('ShipTo3').checked)
			{
				if (getElement('ShipToOther3').value == '' || getElement('ShipToOther3').value == 'Please Specify' )
				{
					alert('Please specify the other source.') ;
					getElement('ShipToOther3').focus() ;
					return false ;
				}
			}
	
	
			//if (frm.PaymentMethod[3].checked)
			if (getElement('PaymentMethod4').checked)
			{
				if (getElement('PaymentOther4').value == '' || getElement('PaymentOther4').value == 'Please Specify' )
				{
					alert('Please specify the other source.') ;
					getElement('PaymentOther4').focus() ;
					return false ;
				}
			}
			
			if(which.BusinessEmail.value == '')	
			{	
					alert('Please make sure that BUSINESS EMAIL field was property completed.') ;
					which.BusinessEmail.focus() ;
					return false ;
			}
			else
			{
				if (verifyMail(which.BusinessEmail) == false) return false;
				//if (checkBusinessEmail(which.BusinessEmail.value) == false) return false;
			}

		}
		//---------------------------------------------------------------
		if(!frm.chkUserAgreement.checked)
		{
			alert('Please make sure that you are agree with the user agreement.') ;
			
			return false ;
		}
		//---------------------------------------------------------------
		return true;		
	}


/* ---------------------------------------------------------------- */
/*	SECTION FOR AJAX FUNCTION FOR PRODUCT IMAGE UPLOAIDNG STARTS   */
/* ---------------------------------------------------------------- */
	function setStatus (theStatus, theObj)
	{
		obj = document.getElementById(theObj);
		if (obj)	obj.innerHTML = theStatus ;
//		alert('setStatus END') ;
	}


	function UploadImage(theform, theaction, img_disp_obj)
	{
//		alert(theaction)
		theform.action=theaction ;
		theform.target="uploadframe"  ;
		theform.submit();
		//alert(theform);
	
		//Then display a loading message to the user.
		setStatus ("<div align='center'><img src='html/images/loading.gif'></div>",img_disp_obj);
	}

	function doneloading( theframe, thefile, img_disp_obj )
	{
//		alert('doneloading START') ;
//		alert( theframe+' - '+thefile+' - '+img_disp_obj ) ;
		var theloc = thefile
		theframe.processajax(img_disp_obj, theloc);
	}

	function processajax (obj, serverPage)
	{
		//Get an XMLHttpRequest object for use.
		var theimg;
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() 
		{
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				document.getElementById(obj).innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null);
	}

/* ---------------------------------------------------------------- */
/*	SECTION FOR AJAX FUNCTION FOR PRODUCT IMAGE UPLOAIDNG END      */
/* ---------------------------------------------------------------- */

	function checkSellerMessage(frm)
	{
		if (checkrequired(frm) == false) return false;		
		return true ;
	}	

//-----------------------------------------	
	function checkBuyerFeedback(frm)
	{
		if (checkrequired(frm) == false) return false;		
		return true ;
	}	
//-----------------------------------------	
	function SetOtherTextBox( CheckBoxID, TextBoxID)
	{
//		if (id == 3)
		{
			if(getElement(CheckBoxID) )
			{
				CheckBoxObj = getElement(CheckBoxID)  ;
				if( getElement(TextBoxID) )
				{
					TextObj =  getElement(TextBoxID) ;
					if (CheckBoxObj.checked) 
					{
						TextObj.style.display = '' ;
						TextObj.focus() ;
					}
					else	// if (CheckBoxObj.checked) 
					{
						TextObj.value = '' ;
						TextObj.style.display = 'none' ;
					}	// else	// if (CheckBoxObj.checked) 
				}	// if( getElement('ShipToOther3') )
			}	// if(getElement('ShipTo3') )
		}
//		else
		{
/*
			if(getElement('ShipToOther3'))
			{
				getElement('ShipToOther3').style.display = 'none' ;
			}	
*/
		}
	}
//-----------------------------------------	
	function checkFooterText(frm)
	{
		if (checkFCKEditorValue('MyEditor', '') == false) return false ;
		if (checkrequired(frm) == false) return false;		
		return true ;
	}
//-----------------------------------------	
	function checkUserAgreement(frm)
	{
		if (checkFCKEditorValue('MyEditor', '') == false) return false ;
		return true ;
	}

//------------------------------------------	
	function checkEditRegistrationUser(which)
	{
//		if (verifyMail(which.requiredEmail) == false) return false;
		
//		if (checkUserName(which.requiredUserName.value) == false) return false;
		
		if (checkrequired(which) == false) return false;
		if (checkFCKEditorValue('MyEditor', '') == false) return false ;

		if(which.WebAddress.value != '')
		{
			if (VerifyLink(which.WebAddress) == false) return false;		
		}
		
		if(which.PhotoFile.value != '')
		{
			if(Imageval(which.PhotoFile)==false) return false  ;
		}
//		alert(getElement('ShipToDefault3')) ;
//		return false ;
//		objchk =  getElement('ShipToDefault3') ;
	
		if (getElement('ShipTo3').checked)
		{
			if (getElement('ShipToOther3').value == '' || getElement('ShipToOther3').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('ShipToOther3').focus() ;
				return false ;
			}
		}


		//if (frm.PaymentMethod[3].checked)
		if (getElement('PaymentMethod4').checked)
		{
			if (getElement('PaymentOther4').value == '' || getElement('PaymentOther4').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('PaymentOther4').focus() ;
				return false ;
			}
		}
		
		if (getElement('IsSeller').checked)
		{
			
			if (which.ItemLocation.value == '')
			{
				alert('Please make sure that ITEM LOCATION DEFAULT field was proeprty completed.') ;
				which.ItemLocation.focus() ;
				return false ;
			}

			if(which.BusinessEmail.value == '')	
			{	
					alert('Please make sure that BUSINESS EMAIL field was property completed.') ;
					which.BusinessEmail.focus() ;
					return false ;
			}
			else
			{
				if (verifyMail(which.BusinessEmail) == false) return false;
				if (checkBusinessEmail(which.BusinessEmail.value) == false) return false;
			}


			
				if (chkSelectedRecordCheckbox(frm, 'ShipTo[]', 'Please make sure that SHIP TO field was proeprty completed.')  == false) 
		{
			location.href='#shipto' ;
			return false ;
		}
		
		if (chkSelectedRecordCheckbox(frm, 'PaymentMethod[]', 'Please make sure that PAYMENT METHOD field was proeprty completed.')  == false) 
		{
			location.href='#paymentmethod' ;
			return false ;
		}

			
			if (getElement('ShipTo3').checked)
			{
				if (getElement('ShipToOther3').value == '' || getElement('ShipToOther3').value == 'Please Specify' )
				{
					alert('Please specify the other source.') ;
					getElement('ShipToOther3').focus() ;
					return false ;
				}
			}
	
	
			//if (frm.PaymentMethod[3].checked)
			if (getElement('PaymentMethod4').checked)
			{
				if (getElement('PaymentOther4').value == '' || getElement('PaymentOther4').value == 'Please Specify' )
				{
					alert('Please specify the other source.') ;
					getElement('PaymentOther4').focus() ;
					return false ;
				}
			}


		}//		if (getElement('IsSeller').checked)
		else
		{
				if (verifyMail(which.BusinessEmail) == false) return false;
				if (checkBusinessEmail(which.BusinessEmail.value) == false) return false;
		}

		//---------------------------------------------------------------
		
//		if (checkEmail(which.requiredEmail.value) == false) return false;
		
//		if(which.requiredPassword.value != "")
//		{
//			if(which.requiredReTypePassword.value != which.requiredPassword.value)
//			{
//				alert("Password Mismatch."); 
//				which.requiredReTypePassword.focus() ;
//				return false ;
//			}
//		}
		return true;		
	}
//-----------------------------------------	
	function checkAddFunds(frm)
	{
		//if (checkrequired(frm) == false) return false;		
		return true ;
	}
//-----------------------------------------	
	function checkBuyItNowForm(frm)
	{
		if (checkrequired(frm) == false) return false;
		frm.BuyItNow.value = '1';
		return true ;
	}	// function checkBuyItNowForm(frm)


	function setShipping(frm)
	{
		id= frm.requiredShipping.value ;
		Qty = parseInt(frm.BuyItNowQty.value) ;
		if (id == '' || Qty == '' || Qty <= 0)
		{
			getElement('ShippingLI').innerHTML = 'No shipping method selected';
			return ;
		}
		selval = ShippingArray[id] ;
		selval = selval.split('~!~') ;
		FirstProductShipping = parseFloat(selval[0]) ;
		OtherProductShipping = parseFloat(selval[1]) ;
		if (Qty >= 1)
		{
			Shipping = FirstProductShipping + (OtherProductShipping * (Qty-1)) 
			frm.shippingprice.value = Shipping;
			getElement('ShippingLI').innerHTML = 'Shipping: $'+(parseFloat(Shipping).toFixed(2)) ;
		}
		else
		{
			
		}
	}

	function getTimeZone() {
	   var rightNow = new Date();
	   var date1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
	   var date2 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0);
	   var temp = date1.toGMTString();
	   var date3 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
	   var temp = date2.toGMTString();
	   var date4 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
	   var hoursDiffStdTime = (date1 - date3) / (1000 * 60 * 60);
	   var hoursDiffDaylightTime = (date2 - date4) / (1000 * 60 * 60);
	   return hoursDiffStdTime ;
	/*   if (hoursDiffDaylightTime == hoursDiffStdTime) { 
		 alert("Time zone is GMT " + hoursDiffStdTime + ".\nDaylight Saving Time is NOT observed here.");
	   } else {
		 alert("Time zone is GMT " + hoursDiffStdTime + ".\nDaylight Saving Time is observed here.");
	   }
	 */
	}

//-----------------------------------------	
	function checkTextPages(frm)
	{
		if (checkFCKEditorValue('MyEditor', '') == false) return false ;
		return true ;
	}

//------------------------------------------	
	function checkCommissionFees(frm)
	{
		if (checkrequired(frm) == false) return false;
		return true ;
	}	// function checkBuyItNowForm(frm)
//------------------------------------------	
	function checkAuctionDuration(frm)
	{
		if (checkrequired(frm) == false) return false;
		return true ;
	}
//----------------------------------------------------
	function checkTemplateEntry(frm)
	{
		if (checkrequired(frm) == false) return false;

/*		if ( !frm.TypeBuyItNow.checked && !frm.TypeAuction.checked )
		{
			alert('Please make sure that TYPE field was properly completed.');
			frm.TypeBuyItNow.focus() ;
			return false ;
		}*/

		//---------------------------------------------------
		if (frm.TypeBuyItNow[1].checked)
		{
			if (getElement('Quantity').value == '' || getElement('Quantity').value == 'Quantity' )
			{
				alert('Please specify the Quantity.') ;
				getElement('Quantity').focus() ;
				return false ;
			}
		}


		if (frm.LimitedEdition[0].checked)
		{
			if (getElement('NoOfPins').value == '' || getElement('NoOfPins').value == 'No of Pins' )
			{
				alert('Please specify the No of Pins.') ;
				getElement('NoOfPins').focus() ;
				return false ;
			}
		}

//		alert(getElement('ShipTo2')) ;
//		return false ;
		if (getElement('ShipTo3').checked)
		{
			if (getElement('ShipToOther3').value == '' || getElement('ShipToOther3').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('ShipToOther3').focus() ;
				return false ;
			}
		}


		//if (frm.PaymentMethod[3].checked)
		if (getElement('PaymentMethod4').checked)
		{
			if (getElement('PaymentOther4').value == '' || getElement('PaymentOther4').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('PaymentOther4').focus() ;
				return false ;
			}
		}

		if (frm.PinType[3].checked)
		{
			if (getElement('PinTypeOther4').value == '' || getElement('PinTypeOther4').value == 'Please Specify' )
			{
				alert('Please specify the other source.') ;
				getElement('PinTypeOther4').focus() ;
				return false ;
			}
		}


		if (chkSelectedRecordCheckbox(frm, 'Category[]', 'Please make sure that CATEGORY field was proeprty completed.')==false)
		{
			location.href='#category' ;
			return false ;
		}
		
		if(getElement('Category1').checked)	// CATEGORY == "PINS"
		{
			if (checkrequiredRadioMsg(frm.PinType, 'PIN TYPE') == false) 
			{
				frm.PinType[0].focus();
				return false ;
			}	// if (checkrequiredRadioMsg(frm.PinType, 'PIN TYPE') == false) 
		}	// if(getElement('Category1').checked)	// CATEGORY == "PINS"

		if (checkFCKEditorValue('MyEditor', '') == false) return false ;	

		if (chkSelectedRecordCheckbox(frm, 'ShipTo[]', 'Please make sure that SHIP TO field was proeprty completed.')  == false) 
		{
			location.href='#shipto' ;
			return false ;
		}
		
		if (chkSelectedRecordCheckbox(frm, 'PaymentMethod[]', 'Please make sure that PAYMENT METHOD field was proeprty completed.')  == false) 
		{
			location.href='#paymentmethod' ;
			return false ;
		}
		//---------------------------------------
		//Shipping Price/Method 1
		if (getElement('ShippingPrice1').value == '' || parseFloat(getElement('ShippingPrice1').value) == 0)
		{
				alert('Please make sure that SHIPPING PRICE 1 field was property completed.') ;
				getElement('ShippingPrice1').focus() ;
				return false ;
		}
		if (frm.TypeBuyItNow[1].checked && parseInt(frm.Quantity.value) > 1 && frm.MultiProductDiscountShipping.checked) // AUCTION TYPE = BUY IT NOW.
		{
			if (getElement('ForEachPrice1').value == '')
			{
				alert('Please make sure that FOR EACH PRICE 1 field was property completed.') ;
				getElement('ForEachPrice1').focus() ;
				return false ;
			}	// if (getElement('ForEachPrice1').value == '')
		}	//	if (frm.TypeBuyItNow[1].checked && parseInt(frm.Quantity.value) > 1 ) // AUCTION TYPE = BUY IT NOW.
		if (getElement('ShipMethod1').value == '')
		{
				alert('Please make sure that SHIPPING METHOD 1 field was property completed.') ;
				getElement('ShipMethod1').focus() ;
				return false ;
		}
		
		//Shipping Price/Method 2

		if ((getElement('ShippingPrice2').value == '' || parseFloat(getElement('ShippingPrice2').value) == 0) && getElement('ShipMethod2').value != '')
		{
				alert('Please make sure that SHIPPING PRICE 2 field was property completed.') ;
				getElement('ShippingPrice2').focus() ;
				return false ;
		}

		if (getElement('ShippingPrice2').value != '' && parseFloat(getElement('ShippingPrice2').value) > 0 && getElement('ShipMethod2').value == '')
		{
				alert('Please make sure that SHIPPING METHOD 2 field was property completed.') ;
				getElement('ShipMethod2').focus() ;
				return false ;
		}


		//Shipping Price/Method 3
		if ((getElement('ShippingPrice3').value == '' || parseFloat(getElement('ShippingPrice3').value) == 0) && getElement('ShipMethod3').value != '')
		{
				alert('Please make sure that SHIPPING PRICE 3 field was property completed.') ;
				getElement('ShippingPrice3').focus() ;
				return false ;
		}

		if (getElement('ShippingPrice3').value != '' && parseFloat(getElement('ShippingPrice3').value) > 0 && getElement('ShipMethod3').value == '')
		{
				alert('Please make sure that SHIPPING METHOD 3 field was property completed.') ;
				getElement('ShipMethod3').focus() ;
				return false ;
		}

/*		if(frm.frmaction.value == 'new')	
		{
			if(frm.Image1.value != '')
			{
				if(Imageval(frm.Image1)==false) return false  ;
			}
			else
			{
				alert('Please make sure that PRODUCT IMAGE1 field is property completed.') ;
				frm.Image1.focus() ;
				return false ;
			}
		}
		else
		{
			for(imgcount=1;imgcount<=4;imgcount++)
			{
				obj = eval('frm.Image'+imgcount) ;
				if(obj.value != '')
				{
					if(Imageval(obj)==false) return false  ;
				}
	
			}
			
		}
*/
		return true ;
	}
//----------------------------------------------------
	function SetProductShipping(id)
	{
//		alert(getElement('ShippingPrice'+id).readOnly) ;
//		getElement('ShippingPrice'+id).disabled = true ;
		if (getElement('FreeShipping'+id).checked) 
		{
			getElement('ShippingPrice'+id).value = 0 ;
			getElement('ShippingPrice'+id).readOnly	= true ;
			getElement('ForEachPrice'+id).value = 0 ;
			getElement('ForEachPrice'+id).readOnly	= true ;
		}
		else
		{
			getElement('ShippingPrice'+id).readOnly	= false ;
			getElement('ForEachPrice'+id).readOnly	= false ;
		}

	}
	function checkForgotPassword(which)
	{
//		if (verifyMail(which.requiredEmail) == false) return false;
		if (checkrequired(which) == false) return false;
		return true;		
	}
//-------------------------------------------------

