function displayIMAge(arg1,arg2)

{

	if(document.getElementById(arg1) != null)

	{

		if(document.getElementById(arg1).value == 'Photo')

		{

			if(document.getElementById(arg2) != null)

			{

				document.getElementById(arg2).style.display='';

			}

			if(document.getElementById("PhotoSelectValue") != null)

			{

				document.getElementById("PhotoSelectValue").value=document.getElementById(arg1).value;

			}

		}

		else

		{

			if(document.getElementById(arg2) != null)

			{

				document.getElementById(arg2).style.display='none';

			}

			if(document.getElementById("PhotoSelectValue") != null)

			{

				document.getElementById("PhotoSelectValue").value=document.getElementById(arg1).value;

			}

			if(document.getElementById('images_container') != null)

			{

				document.getElementById('images_container').innerHTML='';

			}

			if(document.getElementById('imagefileHIDDEn') != null)

			{

				document.getElementById('imagefileHIDDEn').value='';

			}

		}

	}

}

/**************************************TRIM IN JAVASCRIPT STARTS FROM HERE************************************************/

// Removes leading whitespaces

function LTrim( value ) {

	

	var re = /\s*((\S+\s*)*)/;

	return value.replace(re, "$1");

	

}



// Removes ending whitespaces

function RTrim( value ) {

	

	var re = /((\s*\S+)*)\s*/;

	return value.replace(re, "$1");

	

}



// Removes leading and ending whitespaces

function trim( value ) {

	

	return LTrim(RTrim(value));

	

}





function Trim(str)

{  while(str.charAt(0) == (" ") )

  {  str = str.substring(1);

  }

  while(str.charAt(str.length-1) == " " )

  {  str = str.substring(0,str.length-1);

  }

  return str;

}



/************************************************TRIM IN JAVASCRIPT ENDS HERE*******************************************/





function CHEckVALIdatIOn(GetType)

{

	var EmailVALIdation=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	//var NameVAlidation=/[0-9\*\=\_\>\<\:\@\&\%\?\$\-\/\!\^\(\)\{\}\|\~\`\'\"\;\,\.\+\#\\]/;

	var NameVAlidation=/[\*\=\_\>\<\:\@\&\%\?\$\-\/\!\^\(\)\{\}\|\~\`\'\"\;\,\.\+\#\\]/;

	var PhonEVAlidation=/[a-zA-Z\*\=\_\>\<\:\@\&\%\?\$\/\!\^\(\)\{\}\|\~\`\'\"\;\,\.\\]/;

	var AddressvalIDAtiON=/[\*\=\_\>\<\:\@\&\%\?\$\!\^\(\)\{\}\|\~\`\"\;\.\+\#\\]/;

	if(document.getElementById("BusinESSnamE") != null)

	{

		if(document.getElementById("BusinESSnamE").value != '')

		{

			//alert(document.getElementById("FirstName").value)

			//alert(document.getElementById("FirstName").value.search(NameVAlidation))

			if(document.getElementById("BusinESSnamE").value.search(NameVAlidation) >= 0 )

			{

				document.getElementById("BusinESSnamEError").innerHTML="<br>Please use only Characters in your Business name.";

				document.getElementById("BusinESSnamEError").style.display='';

				document.getElementById("BusinESSnamE").focus();

				return false;

			}

			var str =Trim(document.getElementById("BusinESSnamE").value);

			if( str=='')

			{

				document.getElementById("BusinESSnamEError").innerHTML="<br>Please Dont Give Space In Business Name Field.";

				document.getElementById("BusinESSnamEError").style.display='';

				document.getElementById("BusinESSnamE").value="";

				document.getElementById("BusinESSnamE").focus();

				return false;

			}

			else

			{

				document.getElementById("BusinESSnamEError").innerHTML="";

				document.getElementById("BusinESSnamEError").style.display='none';

				if(document.getElementById("BusinESSnamEVALue"+GetType) != null)

				{

					document.getElementById("BusinESSnamEVALue"+GetType).value=document.getElementById("BusinESSnamE").value;

				}

			}

		}

		else

		{

			if(document.getElementById("BusinESSnamEError") != null)

			{

				document.getElementById("BusinESSnamEError").innerHTML="<br>Please Type Your Business Name.";

				document.getElementById("BusinESSnamEError").style.display='';

				document.getElementById("BusinESSnamE").focus();

				return false;

			}

		}

	}



	if(document.getElementById("RepreSEntaTIVe") != null)

	{

		if(document.getElementById("RepreSEntaTIVe").value != '')

		{

			if(document.getElementById("RepreSEntaTIVe").value.search(AddressvalIDAtiON) >= 0)

			{

				document.getElementById("RepreSEntaTIVeError").innerHTML="<br>Please Give Proper Name of Authorized Representative.";

				document.getElementById("RepreSEntaTIVeError").style.display='';

				document.getElementById("RepreSEntaTIVe").focus();

				return false;

			}

			var str =Trim(document.getElementById("RepreSEntaTIVe").value);

			if( str=='')

			{

				document.getElementById("RepreSEntaTIVeError").innerHTML="<br>Please Dont Give Space In Name of Authorized Representative Field.";

				document.getElementById("RepreSEntaTIVeError").style.display='';

				document.getElementById("RepreSEntaTIVe").value="";

				document.getElementById("RepreSEntaTIVe").focus();

				return false;

			}

			else

			{

				document.getElementById("RepreSEntaTIVeError").innerHTML="";

				document.getElementById("RepreSEntaTIVeError").style.display='none';

				if(document.getElementById("RepreSEntaTIVeVALUe"+GetType) != null)

				{

					document.getElementById("RepreSEntaTIVeVALUe"+GetType).value=document.getElementById("RepreSEntaTIVe").value;

				}

			}

		}

		else

		{

			if(document.getElementById("RepreSEntaTIVeError") != null)

			{

				document.getElementById("RepreSEntaTIVeError").innerHTML="<br>Please Type Your Name of Authorized Representative.";

				document.getElementById("RepreSEntaTIVeError").style.display='';

				document.getElementById("RepreSEntaTIVe").focus();

				return false;

			}

		}

	}



	if(document.getElementById("CONTactNO") != null)

	{

		if(document.getElementById("CONTactNO").value != '')

		{

			if(document.getElementById("CONTactNO").value.search(PhonEVAlidation) >= 0)

			{

				document.getElementById("CONTactNOError").innerHTML="<br>Invalid Contact Number.";

				document.getElementById("CONTactNOError").style.display='';

				document.getElementById("CONTactNO").focus();

				return false;

			}

			var str =Trim(document.getElementById("CONTactNO").value);

			if( str=='')

			{

				document.getElementById("CONTactNOError").innerHTML="<br>Please Dont Give Space In Contact Number Field.";

				document.getElementById("CONTactNOError").style.display='';

				document.getElementById("CONTactNO").value="";

				document.getElementById("CONTactNO").focus();

				return false;

			}

			else

			{

				document.getElementById("CONTactNOError").innerHTML="";

				document.getElementById("CONTactNOError").style.display='none';

				if(document.getElementById("CONTactNOVALUe"+GetType) != null)

				{

					document.getElementById("CONTactNOVALUe"+GetType).value=document.getElementById("CONTactNO").value;

				}

			}

		}

		else

		{

			if(document.getElementById("CONTactNOError") != null)

			{

				document.getElementById("CONTactNOError").innerHTML="<br>Please Type Your Contact Number.";

				document.getElementById("CONTactNOError").style.display='';

				document.getElementById("CONTactNO").focus();

				return false;

			}

		}

	}



	if(document.getElementById("EMAil") != null)

	{

		if(document.getElementById("EMAil").value != '')

		{

			if(!EmailVALIdation.test(document.getElementById("EMAil").value))

			{

				document.getElementById("EMAilError").innerHTML="<br>Invalid Email Address.";

				document.getElementById("EMAilError").style.display='';

				document.getElementById("EMAil").focus();

				return false;

			}

			else

			{

				document.getElementById("EMAilError").innerHTML="";

				document.getElementById("EMAilError").style.display='none';

				if(document.getElementById("EMAilVALue"+GetType) != null)

				{

					document.getElementById("EMAilVALue"+GetType).value=document.getElementById("EMAil").value;

				}

				//return false;

			}

		}

		else

		{

			if(document.getElementById("EMAilError") != null)

			{

				document.getElementById("EMAilError").innerHTML="<br>Please Type Your Email.";

				document.getElementById("EMAilError").style.display='';

				document.getElementById("EMAil").focus();

				return false;

			}

		}

	}





}









function PayEmenTsELeCt(DisPlayId,SecONdId,ThiRDId)

{

	if(document.getElementById(DisPlayId) != null)

	{

		if(document.getElementById(DisPlayId).checked == true)

		{

			if(document.getElementById('TD_'+DisPlayId) != null)

			{

				document.getElementById('TD_'+DisPlayId).style.display='';

			}

			if(document.getElementById(DisPlayId+'_maxBUDgt') != null)

			{

				document.getElementById(DisPlayId+'_maxBUDgt').style.display='';

			}

			if(document.getElementById('TD_'+SecONdId) != null)

			{

				document.getElementById('TD_'+SecONdId).style.display='none';

			}

			if(document.getElementById(SecONdId+'_maxBUDgt') != null)

			{

				document.getElementById(SecONdId+'_maxBUDgt').style.display='none';

			}

			if(document.getElementById('TD_'+ThiRDId) != null)

			{

				document.getElementById('TD_'+ThiRDId).style.display='none';

			}

			if(document.getElementById(ThiRDId+'_maxBUDgt') != null)

			{

				document.getElementById(ThiRDId+'_maxBUDgt').style.display='none';

			}

			if(document.getElementById('ButtNName') != null)

			{

				document.getElementById('ButtNName').value=DisPlayId;

			}			

			if(document.getElementById('IAGREE') != null)

			{

				document.getElementById('IAGREE').checked=false;

			}

			if(document.getElementById('BUTTN_'+DisPlayId) != null)

			{

				document.getElementById('BUTTN_'+DisPlayId).disabled=true;

			}

			if(document.getElementById('BUTTN_'+SecONdId) != null)

			{

				document.getElementById('BUTTN_'+SecONdId).disabled=true;

			}

			if(document.getElementById('BUTTN_'+ThiRDId) != null)

			{

				document.getElementById('BUTTN_'+ThiRDId).disabled=true;

			}

			

		}

	}

}







/*function textCounter(field,cntfield,maxlimit,displayId,e,HiddenFieldText) {

	if(document.getElementById(field) != null) // if too long...trim it!

	{

		//if (!e) var e = window.event;

			if (!e) var e = window.event

			if (e.keyCode) code = e.keyCode;

			else if (e.which) code = e.which;





		if (document.getElementById(field).value.length > maxlimit)

		{

			document.getElementById(field).value = document.getElementById(field).value.substring(0, maxlimit);

		}

	// otherwise, update 'characters left' counter

		else

		{

			//alert(document.getElementById(cntfield));

			if(document.getElementById(cntfield) != null)

			{

				document.getElementById(cntfield).innerHTML = maxlimit - document.getElementById(field).value.length;

			}

			if(document.getElementById(displayId) != null)

			{

				if(document.getElementById(field).value != '')

				{

					//alert(document.getElementById(field).value+"--");

					

					if(document.getElementById(HiddenFieldText).value != '')

					{

						var HIDDENfieldValueAfterReplace=document.getElementById(HiddenFieldText).value.replace('<br />',"");

						//alert(HIDDENfieldValueAfterReplace);

						//if()

						var HIDDENfieldLenGth=HIDDENfieldValueAfterReplace.length;

					}

					var TEXTAREAvalue=document.getElementById(field).value;

					if(document.getElementById(displayId).style.display == 'none')

					{

						document.getElementById(displayId).style.display = '';

					}

					if (c == 13)

					{

						//alert(document.getElementById(field).value)

						alert(HIDDENfieldLenGth);alert(TEXTAREAvalue);alert(TEXTAREAvalue.length)

						alert(TEXTAREAvalue.substring(HIDDENfieldLenGth))

						document.getElementById(HiddenFieldText).value=document.getElementById(HiddenFieldText).value+TEXTAREAvalue.substring(HIDDENfieldLenGth)+'<br />';

						//document.getElementById(displayId).innerHTML=document.getElementById(field).value+'<br />';

						

					}

					else

					{

						document.getElementById(HiddenFieldText).value=document.getElementById(HiddenFieldText).value+TEXTAREAvalue.substring(HIDDENfieldLenGth);

					}

					document.getElementById(displayId).innerHTML=document.getElementById(HiddenFieldText).value; 

				}			

				else

				{

					var tempHOLDvalue = document.getElementById(displayId).innerHTML;

					if(displayId == 'AddDEScription')

						document.getElementById(displayId).innerHTML='To View Type Your Content In The Text Field';

					else

					{

						document.getElementById(displayId).innerHTML='';

						document.getElementById(displayId).style.display = 'none';

					}

					document.getElementById(HiddenFieldText).value='';

				}

			}

		}

	}

}*/



function textCounter(field,cntfield,maxlimit,displayId) {

	if(document.getElementById(field) != null) // if too long...trim it!

	{

		if (document.getElementById(field).value.length > maxlimit)

		{

			document.getElementById(field).value = document.getElementById(field).value.substring(0, maxlimit);

		}

	// otherwise, update 'characters left' counter

		else

		{

			//alert(document.getElementById(cntfield));

			if(document.getElementById(cntfield) != null)

			{

				document.getElementById(cntfield).innerHTML = maxlimit - document.getElementById(field).value.length;

			}

			if(document.getElementById(displayId) != null)

			{

				if(document.getElementById(field).value != '')

				{

					if(document.getElementById(displayId).style.display == 'none')

					{

						document.getElementById(displayId).style.display = '';

					}

					if(displayId == "AddDEScription")

					{

						document.getElementById(displayId).innerHTML='<textarea name="textarea" rows="7" disabled="disabled" style="border:#E5E5E5 1px solid; background:#E5E5E5; width:257px; height:115px;">'+document.getElementById(field).value+'</textarea>'; 

					}

					else

					{

						document.getElementById(displayId).innerHTML=document.getElementById(field).value;

					}

				}			

				else

				{

					var tempHOLDvalue = document.getElementById(displayId).innerHTML;

					if(displayId == 'AddDEScription')

						document.getElementById(displayId).innerHTML='To View Type Your Content In The Text Field';

					else

					{

						document.getElementById(displayId).innerHTML='';

						document.getElementById(displayId).style.display = 'none';

					}

				}

			}

		}

	}

}







function CheckValidationFORstep1()

{

	//alert("asdasdasd");

	if(document.getElementById("websiteName") != null)

	{

		if(document.getElementById("websiteName").value != '' )

		{

			var HOLdvaLue=document.getElementById("websiteName").value;

			//if( document.getElementById("websiteName").value != 'www.top6.com.au')

				var REturnVAlue=checkDomain(HOLdvaLue);

			//else

				//REturnVAlue = 'success';

			//alert(REturnVAlue);

			if(REturnVAlue == 'success')

			{

				if(document.getElementById("websiteNameError") != null)

				{

					document.getElementById("websiteNameError").innerHTML='';

					document.getElementById("websiteNameError").style.display='none';

				}

				if(document.getElementById("step2") != null && document.getElementById("step2").style.display !='')

				{

					if(document.getElementById("inPUTbuTTOn") != null)

					{

						document.getElementById("inPUTbuTTOn").innerHTML='<img src="images/indicator_blue_small.gif" border="0"  />';

					}

					setTimeout('showLOaDing("step2")',5000);

				}

				else

					CheckValidationFORstep2();

			}

			else

			{

				document.getElementById("websiteNameError").innerHTML=REturnVAlue;

				document.getElementById("websiteNameError").style.display='';

				return false;

			}

		}

		else

		{

			//alert(document.getElementById("websiteNameError"));

			if(document.getElementById("websiteNameError") != null)

			{

				document.getElementById("websiteNameError").innerHTML='<br/>Please enter in applicable URL/Web Link';

				document.getElementById("websiteNameError").style.display='';

				return false;

			}

		}

	}

	

	/*if(document.getElementById("websiteName") != null)

	{

		if(document.getElementById("websiteName").value != '')

		{

			if(document.getElementById("websiteNameError") != null)

			{

				document.getElementById("websiteNameError").innerHTML='';

				document.getElementById("websiteNameError").style.display='none';

			}

			if(document.getElementById("inPUTbuTTOn") != null)

			{

				document.getElementById("inPUTbuTTOn").innerHTML='<img src="images/indicator_blue_small.gif" border="0"  />';

			}

			setTimeout('showLOaDing("step2")',5000);

		}

		else

		{

			//alert(document.getElementById("websiteNameError"));

			if(document.getElementById("websiteNameError") != null)

			{

				document.getElementById("websiteNameError").innerHTML='Field Cannot Be Empty';

				document.getElementById("websiteNameError").style.display='';

			}

		}

	}*/

}

function CheckValidationFORstep2()

{

	if(document.getElementById("Title") != null)

	{

		if(document.getElementById("Title").value != '')

		{

			var tempHoldVALUE=document.getElementById("Title").value.split(' ');

			var TEMpFLag=0;

			for(var i=0; i<tempHoldVALUE.length; i++)

			{

				if(tempHoldVALUE[i].length > 12)

				{

					TEMpFLag=1;

					break;

				}

			}

			if(document.getElementById("TitleError") != null)

			{

				if(TEMpFLag == 1)

				{

					document.getElementById("TitleError").innerHTML='<br/>Please note: Word Characters must not be greater than 15<br/>';//''<br/>Word Charecter Can not be graterthen 12';

					document.getElementById("TitleError").style.display='';

					return false;

				}

				else

				{

					document.getElementById("TitleError").innerHTML='';

					document.getElementById("TitleError").style.display='none';

				}

			}

		}

		else

		{

			//alert(document.getElementById("websiteNameError"));

			if(document.getElementById("TitleError") != null)

			{

				document.getElementById("TitleError").innerHTML='<br/>Please enter in your desired Title';

				document.getElementById("TitleError").style.display='';

				return false;

			}

		}

	}

	if(document.getElementById("Body") != null)

	{

		if(document.getElementById("Body").value != '')

		{

			

			var tempHoldVALUE=document.getElementById("Body").value.split(' ');

			var TEMpFLag=0;

			for(var i=0; i<tempHoldVALUE.length; i++)

			{

				if(tempHoldVALUE[i].length > 20)

				{

					TEMpFLag=1;

					break;

				}

			}

			if(document.getElementById("BodyError") != null)

			{

				if(TEMpFLag == 1)

				{

					document.getElementById("BodyError").innerHTML='<br/>The text has a word that is longer than 20 characters in length';

					document.getElementById("BodyError").style.display='';

					return false;

				}

				else

				{

					document.getElementById("BodyError").innerHTML='';

					document.getElementById("BodyError").style.display='none';

					if(document.getElementById("PhotoSelectValue") != null && document.getElementById("PhotoSelectValue").value != 'Photo')

					{

						if(document.getElementById("step3") != null && document.getElementById("step3").style.display !='')

						{

							if(document.getElementById("inPUTbuTTOn") != null)

							{

								document.getElementById("inPUTbuTTOn").innerHTML='<img src="images/indicator_blue_small.gif" border="0"  />';

							}

							setTimeout('showLOaDing("step3")',5000);

						}

						else

							CheckValidationFORstep3();

					}

				}

			}			

		}

		else

		{

			//alert(document.getElementById("websiteNameError"));

			if(document.getElementById("BodyError") != null)

			{

				document.getElementById("BodyError").innerHTML='<br/>Please enter your advertisement body';

				document.getElementById("BodyError").style.display='';

				return false;

			}

		}

	}

	if(document.getElementById("PhotoSelectValue") != null && document.getElementById("PhotoSelectValue").value == 'Photo')

	{

		if(document.getElementById("imagefileHIDDEn") != null)

		{

			if(document.getElementById("imagefileHIDDEn").value != '')

			{

				

				var path=document.getElementById("imagefileHIDDEn").value.toUpperCase();

				var fileNAme=document.getElementById("imagefileHIDDEn").value;

				var dot = path.lastIndexOf(".");

				//alert(dot);

				if( dot == -1 ) 

				{

					document.getElementById('imageFileError').innerHTML="<br/>Extention Is not valid!";

					document.getElementById("imageFileError").style.display='';

					document.getElementById("imagefileHIDDEn").select(); 

					return false;

				}

				else

				{

					var extension = fileNAme.substr(dot,fileNAme.length).toUpperCase();

					//alert(extension);

					//alert(document.getElementById("ChaLLEngeTyPe").value);

						if(document.getElementById("imagefileHIDDEn").value !='')

						{

							if( extension=='.JPG' || extension=='.JPEG' || extension=='.GIF' || extension=='.PNG' )

							{

								document.getElementById("imageFileError").innerHTML='';

								document.getElementById("imageFileError").style.display='none';

								if(document.getElementById("step3") != null && document.getElementById("step3").style.display !='')

								{

									if(document.getElementById("inPUTbuTTOn") != null)

									{

										document.getElementById("inPUTbuTTOn").innerHTML='<img src="images/indicator_blue_small.gif" border="0"  />';

									}

									setTimeout('showLOaDing("step3")',5000);

								}

								else

									CheckValidationFORstep3();								

							}

							else

							{

								document.getElementById('imageFileError').innerHTML="<br/>please upload  .jpeg , .JPEG , .jpg , .JPG , .gif , .GIF , .png , .PNG file . ";

								document.getElementById("imageFileError").style.display='';

								document.getElementById("imagefileHIDDEn").select(); 

								return false;

							}

						}

				}

				

				

			}

			else

			{

				document.getElementById("imageFileError").innerHTML='<br/>Please upload your desired image';

				document.getElementById("imageFileError").style.display='';

				return false;

			}

		}

	}

}



function CheckValidationFORstep3()

{

	//alert('dsfdsfdsf');

	var FLAg=0;

	if(document.getElementById("minSTateID") != null)

	{

		var MINID=document.getElementById("minSTateID").value;

	}

	if(document.getElementById("maxSTateID") != null)

	{

		var MAXID=document.getElementById("maxSTateID").value;

	}

	if(MINID != '' && MAXID != '')

	{

		for(var i=MINID; i<=MAXID;i++)

		{

			if(document.getElementById("state"+i) != null)

			{

				if(document.getElementById("state"+i).checked == true)

				{

					FLAg=1;

					break;

				}

			}

		}

	}

	//alert(FLAg);

	if(FLAg == 0)

	{

		//alert("asdasdasdas1234556");

		document.getElementById("stateChooseError").innerHTML='<br/>Please select desired state/s';

		document.getElementById("stateChooseError").style.display='';

		return false;

	}

	else

	{

		document.getElementById("stateChooseError").innerHTML='';

		document.getElementById("stateChooseError").style.display='none';

		

	}

	

	

	

	var Flag=0;

	var COUnter=0;

	if(document.getElementById("minPAGEtABLE") != null)

	{

		var MINtableID=document.getElementById("minPAGEtABLE").value;

	}

	if(document.getElementById("maxPAGEtABLE") != null)

	{

		var MAXtableID=document.getElementById("maxPAGEtABLE").value;

	}

	var FlagForDISAbled=0;

	if(MINtableID != '' && MAXtableID != '')

	{

		for(var i=MINtableID; i<=MAXtableID;i++)

		{

			if(document.getElementById("pageTable"+i) != null)

			{

				COUnter++;

				if(document.getElementById("pageTable"+i).checked == true)

				{

					Flag=1;

					break;

				}

				if(document.getElementById("pageTable"+i).disabled == true)

				{

					FlagForDISAbled++;

				}

			}

		}

	}

	//alert(FLAg);

	if(FlagForDISAbled != 0 && FlagForDISAbled == COUnter)

	{

		//document.getElementById("PAGETabLEChooseError").innerHTML='<br/>Sorry There Is No slots Availavel To Give Ads.';

		document.getElementById("PAGETabLEChooseError").innerHTML='<br/>Unfortunately, no advertisement slots are currently available. For more information, contact us at <a href="mailto:inquire@everydaypeople.net.au">inquire@everydaypeople.net.au</a>';

		document.getElementById("PAGETabLEChooseError").style.display='';

		return false;	

	}

	else if(Flag == 0)

	{

		//alert("asdasdasdas1234556");

		document.getElementById("PAGETabLEChooseError").innerHTML='<br/>Please select your desired Target Market/s';

		document.getElementById("PAGETabLEChooseError").style.display='';

		return false;

	}

	else

	{

		document.getElementById("PAGETabLEChooseError").innerHTML='';

		document.getElementById("PAGETabLEChooseError").style.display='none';

		

	}

	if(document.getElementById("Days") != null)

	{

		if(document.getElementById("Days").value == '')

		{

			if(document.getElementById("DaysError") != null)

			{

				document.getElementById("DaysError").innerHTML='<br/>You must select atleast one ';

				document.getElementById("DaysError").style.display='';

				return false;

			}

		}

		else

		{

			if(document.getElementById("DaysError") != null)

			{

				document.getElementById("DaysError").innerHTML='';

				document.getElementById("DaysError").style.display='';

				//return false;

			}

			

		}

	}

	if(document.getElementById("ADVERtise") != null)

	{

		if(document.getElementById("step4") != null && document.getElementById("step4").style.display !='')

		{

			if(document.getElementById("inPUTbuTTOn") != null)

			{

				document.getElementById("inPUTbuTTOn").innerHTML='<img src="images/indicator_blue_small.gif" border="0"  />';

			}

			setTimeout('showLOaDing("step4")',5000);

		}

		else

			CheckValidationFORstep4();

	}

}

function CheckValidationFORstep4()

{

	//alert("step4");

	/*if(document.getElementById("DATEINerhtMLshow") != null && document.getElementById("DATEINerhtMLshow").style.display != 'none')

	{*/

		//step4Error

		var TEMPSUGGEstedBidMAX='';

		var TEMPSUGGEstedBidMIN='';

		var TEMPbidTYPE='';

		if(document.getElementById("SUGGEstedBidMAX") != null)

		{

			TEMPSUGGEstedBidMAX=document.getElementById("SUGGEstedBidMAX").value;

		}

		if(document.getElementById("SUGGEstedBidMIN") != null)

		{

			TEMPSUGGEstedBidMIN=document.getElementById("SUGGEstedBidMIN").value;

		}

		//alert(document.getElementById("SUGGEstedBidMIN"));

		if(document.getElementById("BIDtyPE") != null)

		{

			TEMPbidTYPE=document.getElementById("BIDtyPE").value;

		}

		//alert(TEMPbidTYPE)

		//alert(TEMPSUGGEstedBidMAX+'---'+TEMPSUGGEstedBidMIN+'---'+TEMPbidTYPE);return false;

		

		if(document.getElementById("MAxbudGet") != null)

		{

			if(document.getElementById("MAxbudGet").value == '')

			{

				if(document.getElementById("step4Error") != null)

				{

					document.getElementById("step4Error").innerHTML='<br/>Please enter in your advertisement budget. ';

					document.getElementById("step4Error").style.display='';

				}

				document.getElementById("MAxbudGet").focus;

				return false;

			}
			
			if(document.getElementById("cpc_bid_value").value == "0.00")

			{

				if(document.getElementById("step4Error") != null)

				{

					document.getElementById("step4Error").innerHTML='<br/>Invalid Cost Amount. ';

					document.getElementById("step4Error").style.display='';

				}

				document.getElementById("MAxbudGet").focus;

				return false;

			}

			else

			{


				// commented by chalki on 07.03.2011
				
				/*
				if(parseFloat(document.getElementById("MAxbudGet").value) < parseFloat(document.getElementById("cpc_bid_value").value))

				{

					//alert(TEMPbidTYPE);

					if( TEMPbidTYPE == 'CPC')

					{

						

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>Please note: Total Budget entered cannot be less than Cost per click or Cost per view';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("default_daily_budget").focus;

						return false;

					}

					else

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>Please note: Total Budget entered cannot be less than Cost per click or Cost per view';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("default_daily_budget").focus;

						return false;
					}
				}
				
				else if(document.getElementById("step4Error") != null) {
					document.getElementById("step4Error").innerHTML='';
					document.getElementById("step4Error").style.display='none';
				}
				*/
				
			}
			

		}

		

		

		if(document.getElementById("default_daily_budget") != null)

		{

			if(document.getElementById("default_daily_budget").value == '')

			{

				if(document.getElementById("step4Error") != null)

				{

					document.getElementById("step4Error").innerHTML='<br/>You must entered default daily budget. ';

					document.getElementById("step4Error").style.display='';

				}

				document.getElementById("default_daily_budget").focus;

				return false;

			}

			else

			{

				var dailyLIMIts='';

				if(document.getElementById("dailYLIMits") != null)

				{

					dailyLIMIts=document.getElementById("dailYLIMits").value;

				}

				if(parseFloat(document.getElementById("default_daily_budget").value) < parseFloat(dailyLIMIts))

				{

					if(document.getElementById("step4Error") != null)

					{

						document.getElementById("step4Error").innerHTML='<br/>Please note: Minimum price selected can’t be less than the price set by admin';

						document.getElementById("step4Error").style.display='';

					}

					document.getElementById("default_daily_budget").focus;

					return false;

				}
				
				// commented by chalki on 07.03.2011

				/*else if(parseFloat(document.getElementById("default_daily_budget").value) < parseFloat(document.getElementById("cpc_bid_value").value))

				{

					//alert(TEMPbidTYPE);

					if( TEMPbidTYPE == 'CPC')

					{

						

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>Please note: Total Budget entered cannot be less than Cost per click or Cost per view';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("default_daily_budget").focus;

						return false;

					}

					else

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>Please note: Total Budget entered cannot be less than Cost per click or Cost per view';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("default_daily_budget").focus;

						return false;

						

					}

				}

				else

				{

					if(document.getElementById("step4Error") != null)

					{

						document.getElementById("step4Error").innerHTML='';

						document.getElementById("step4Error").style.display='none';

					}

				}
				*/
				

				

			}

		}

		if(document.getElementById("cpc_bid_value") != null)

		{

			if(document.getElementById("cpc_bid_value").value == '')

			{

				if(document.getElementById("step4Error") != null)

				{

					document.getElementById("step4Error").innerHTML='<br/>You must entered suggested bid. ';

					document.getElementById("step4Error").style.display='';

				}

				document.getElementById("cpc_bid_value").focus;

				return false;

			}

			else

			{

				/*if( TEMPbidTYPE == 'CPC')

				{

					if(document.getElementById("cpc_bid_value").value < TEMPSUGGEstedBidMIN)

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='You Cannot Give Lessthen '+TEMPSUGGEstedBidMIN;

							document.getElementById("step4Error").style.display='';

						}

					}

					if(document.getElementById("cpc_bid_value").value > TEMPSUGGEstedBidMAX)

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='You Cannot Give Graterthen '+TEMPSUGGEstedBidMAX;

							document.getElementById("step4Error").style.display='';

						}

					}

				}

				else if( TEMPbidTYPE == 'CPM in Ad Space')

				{

					if(document.getElementById("cpc_bid_value").value < SUGGESTbidMIN)

					{

						

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='You Cannot Give Lessthen '+SUGGESTbidMIN;

							document.getElementById("step4Error").style.display='';

						}

					}

					if(document.getElementById("cpc_bid_value").value > SUGGESTbidMAX)

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='You Cannot Give Graterthen '+SUGGESTbidMAX;

							document.getElementById("step4Error").style.display='';

						}

					}

					

				}

				else

				{*/

					if(document.getElementById("step4Error") != null)

					{

						document.getElementById("step4Error").innerHTML='';

						document.getElementById("step4Error").style.display='none';

					}

				//}

			}

		}

		

		if(document.getElementById("radioDATedisplay") != null)

		{

			if(document.getElementById("radioDATedisplay").checked == true)

			{

				

				if(document.getElementById("start_time_month") != null)

				{

					if(document.getElementById("start_time_month").value == '')

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>You must select one start month. ';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("start_time_month").focus;

						return false;

					}

					else

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='';

							document.getElementById("step4Error").style.display='none';

						}

						

					}

				}

				

				if(document.getElementById("start_time_day") != null)

				{

					if(document.getElementById("start_time_day").value == '')

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>You must select one start day. ';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("start_time_day").focus;

						return false;

					}

					else

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='';

							document.getElementById("step4Error").style.display='none';

						}

						

					}

				}

				

				if(document.getElementById("start_time_year") != null)

				{

					if(document.getElementById("start_time_year").value == -1 || document.getElementById("start_time_year").value == '')

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>You must select one start year. ';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("start_time_year").focus;

						return false;

					}

					else

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='';

							document.getElementById("step4Error").style.display='none';

						}

						

					}

				}

				

				

				if(document.getElementById("end_time_month") != null)

				{

					if(document.getElementById("end_time_month").value == '')

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>You must select one end month. ';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("end_time_month").focus;

						return false;

					}

					else

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='';

							document.getElementById("step4Error").style.display='none';

						}

						

					}

				}

				

				

				if(document.getElementById("end_time_day") != null)

				{

					if(document.getElementById("end_time_day").value == '')

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>You must select one end day. ';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("end_time_day").focus;

						return false;

					}

					else

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='';

							document.getElementById("step4Error").style.display='none';

						}

						

					}

				}

				

				

				if(document.getElementById("end_time_year") != null)

				{

					if(document.getElementById("end_time_year").value == '' || document.getElementById("end_time_year").value == -1)

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='<br/>You must select one end year. ';

							document.getElementById("step4Error").style.display='';

						}

						document.getElementById("end_time_year").focus;

						return false;

					}

					else

					{

						if(document.getElementById("step4Error") != null)

						{

							document.getElementById("step4Error").innerHTML='';

							document.getElementById("step4Error").style.display='none';

						}

						

					}

				}

				

				if(document.getElementById("start_time_day") != null && document.getElementById("end_time_day") != null )

				{

					//alert(document.getElementById("end_time_day").value +'<'+ document.getElementById("start_time_day").value)

					if(parseInt(document.getElementById("end_time_day").value) < parseInt(document.getElementById("start_time_day").value))

					{

						//alert("sadasdasdasda");

						//alert(document.getElementById("step4Error"));

						if(document.getElementById("end_time_month").value < document.getElementById("start_time_month").value)

						{

							if(document.getElementById("step4Error") != null)

							{

								document.getElementById("step4Error").innerHTML='<br/>end month must grater then start month. ';

								document.getElementById("step4Error").style.display='';

							}

							//document.getElementById("end_time_month").focus;

							return false;

						}

						else if(document.getElementById("end_time_month").value == document.getElementById("start_time_month").value)

						{

							if(document.getElementById("step4Error") != null)

							{

								document.getElementById("step4Error").innerHTML='<br/>end month must grater then start month. ';

								document.getElementById("step4Error").style.display='';

							}

							//document.getElementById("end_time_month").focus;

							return false;

						}

						else

						{

							if(document.getElementById("step4Error") != null)

							{

								document.getElementById("step4Error").innerHTML='';

								document.getElementById("step4Error").style.display='none';

							}

							

						}

					}

				}

				//alert('44444====='+document.getElementById("Days"))

				

				/*if(document.getElementById("Days") != null)

				{

					if(document.getElementById("Days").value == 'fortnightly')

					{

						if(document.getElementById("start_time_day") != null || document.getElementById("end_time_day") != null )

						{

							if(parseInt(document.getElementById("end_time_day").value) > parseInt(parseInt(document.getElementById("start_time_day").value) +1))

							{

								

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='<br/> You Choose Fortnight So Choose The Day Properly. ';

									document.getElementById("step4Error").style.display='';

								}

								//document.getElementById("end_time_month").focus;

								return false;

								

							}

							else

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='';

									document.getElementById("step4Error").style.display='none';

								}

								

							}

							if(parseInt(document.getElementById("end_time_month").value) > parseInt(document.getElementById("start_time_month").value))

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='<br/> You Choose Fortnight So Choose The Month Properly. ';

									document.getElementById("step4Error").style.display='';

								}

								//document.getElementById("end_time_month").focus;

								return false;

							}

							else if(parseInt(parseInt(document.getElementById("end_time_day").value) - parseInt(document.getElementById("start_time_day").value)) >1 || parseInt(parseInt(document.getElementById("end_time_day").value) - parseInt(document.getElementById("start_time_day").value)) <1 )

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='<br/> You Choose Fortnight So Choose The Day Properly Differance Should Equalto 1. ';

									document.getElementById("step4Error").style.display='';

								}

								//document.getElementById("end_time_month").focus;

								return false;

							}

							else

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='';

									document.getElementById("step4Error").style.display='none';

								}

								

							}

						}				

					}

					

					

					else if(document.getElementById("Days").value == 'weekly')

					{

						if(document.getElementById("start_time_day") != null || document.getElementById("end_time_day") != null )

						{

							if(parseInt(document.getElementById("end_time_day").value) > parseInt(parseInt(document.getElementById("start_time_day").value) +7))

							{

								

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='<br/> You Choose Weekly So Choose The Day Properly. ';

									document.getElementById("step4Error").style.display='';

								}

								//document.getElementById("end_time_month").focus;

								return false;

								

							}

							else if(parseInt(parseInt(document.getElementById("end_time_day").value) - parseInt(document.getElementById("start_time_day").value)) >7 || parseInt(parseInt(document.getElementById("end_time_day").value) - parseInt(document.getElementById("start_time_day").value)) <7 )

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='<br/> You Choose Weekly So Choose The Day Properly Differance Should Equalto 7. ';

									document.getElementById("step4Error").style.display='';

								}

								//document.getElementById("end_time_month").focus;

								return false;

							}

							else

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='';

									document.getElementById("step4Error").style.display='none';

								}

								

							}

							if(parseInt(document.getElementById("end_time_month").value) > parseInt(document.getElementById("start_time_month").value))

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='<br/> You Choose Weekly So Choose The Month Properly. ';

									document.getElementById("step4Error").style.display='';

								}

								//document.getElementById("end_time_month").focus;

								return false;

							}

							else

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='';

									document.getElementById("step4Error").style.display='none';

								}

								

							}

						}				

					}

					else if(document.getElementById("Days").value == 'monthtly')

					{

						//alert(parseInt(parseInt(document.getElementById("end_time_month").value) - parseInt(document.getElementById("start_time_month").value)));

						if(parseInt(parseInt(document.getElementById("end_time_month").value) - parseInt(document.getElementById("start_time_month").value)) == 0 )

						{	

							if(document.getElementById("end_time_month").value == 2 && document.getElementById("start_time_month").value == 2 )

							{

								//alert(parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt(document.getElementById("start_time_day").value)))

								if(parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt(document.getElementById("start_time_day").value)) >=28 && parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt(document.getElementById("start_time_day").value)) <30 )

								{

									if(document.getElementById("step4Error") != null)

									{

										document.getElementById("step4Error").innerHTML='';

										document.getElementById("step4Error").style.display='none';

									}

								}

								else

								{

									if(document.getElementById("step4Error") != null)

									{

										document.getElementById("step4Error").innerHTML='<br/> You Choose Monthly So Choose The Day Properly Differance Should Equalto 30. ';

										document.getElementById("step4Error").style.display='';

									}

									//document.getElementById("end_time_month").focus;

									return false;

								}

							}

							else 

							{

								if(parseInt(parseInt(document.getElementById("end_time_day").value) - parseInt(document.getElementById("start_time_day").value)) >30 || parseInt(parseInt(document.getElementById("end_time_day").value) - parseInt(document.getElementById("start_time_day").value)) <30 )

								{

									if(document.getElementById("step4Error") != null)

									{

										document.getElementById("step4Error").innerHTML='<br/> You Choose Monthly So Choose The Day Properly Differance Should Equalto 30. ';

										document.getElementById("step4Error").style.display='';

									}

									//document.getElementById("end_time_month").focus;

									return false;

								}

								else

								{

									if(document.getElementById("step4Error") != null)

									{

										document.getElementById("step4Error").innerHTML='';

										document.getElementById("step4Error").style.display='none';

									}

									

								}

							}

						}

						else if(parseInt(parseInt(document.getElementById("end_time_month").value) - parseInt(document.getElementById("start_time_month").value)) == 1)

						{

							if(document.getElementById("end_time_month").value == 2 && document.getElementById("start_time_month").value == 2 )

							{

								//alert(parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt(document.getElementById("start_time_day").value)))

								if(parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt(document.getElementById("start_time_day").value)) >=28 && parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt(document.getElementById("start_time_day").value)) <30 )

								{

									if(document.getElementById("step4Error") != null)

									{

										document.getElementById("step4Error").innerHTML='';

										document.getElementById("step4Error").style.display='none';

									}

								}

								else

								{

									if(document.getElementById("step4Error") != null)

									{

										document.getElementById("step4Error").innerHTML='<br/> You Choose Monthly So Choose The Day Properly Differance Should Equalto 30. ';

										document.getElementById("step4Error").style.display='';

									}

									//document.getElementById("end_time_month").focus;

									return false;

								}

							}

							else 

							{

								//if(parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt(document.getElementById("start_time_day").value)) >30 || parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt(document.getElementById("start_time_day").value)) <30 )

								if(parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt( 30 - parseInt(document.getElementById("start_time_day").value))) >30 || parseInt(parseInt(document.getElementById("end_time_day").value) + parseInt( 30 - parseInt(document.getElementById("start_time_day").value))) <30 )

								{

									if(document.getElementById("step4Error") != null)

									{

										document.getElementById("step4Error").innerHTML='<br/> You Choose Monthly So Choose The Day Properly Differance Should Equalto 30. ';

										document.getElementById("step4Error").style.display='';

									}

									//document.getElementById("end_time_month").focus;

									return false;

								}

								else

								{

									if(document.getElementById("step4Error") != null)

									{

										document.getElementById("step4Error").innerHTML='';

										document.getElementById("step4Error").style.display='none';

									}

									

								}

							}

						}

						else if(parseInt(parseInt(document.getElementById("end_time_month").value) - parseInt(document.getElementById("start_time_month").value)) >1 || parseInt(parseInt(document.getElementById("end_time_month").value) - parseInt(document.getElementById("start_time_month").value)) <0)

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='<br/> You Choose Monthly So Choose The Month Properly Differance Should Equalto 1. ';

									document.getElementById("step4Error").style.display='';

								}

								//document.getElementById("end_time_month").focus;

								return false;

							}

							else

							{

								if(document.getElementById("step4Error") != null)

								{

									document.getElementById("step4Error").innerHTML='';

									document.getElementById("step4Error").style.display='none';

								}

								

							}				

					}

				}*/

			}

		}

	//}

	

	

	if(document.getElementById("step4Error") != null)

	{

		if(document.getElementById("step4Error").innerHTML == '' && document.getElementById("step4Error").style.display == 'none' )

		{

			document.getElementById("ADVERtise").action="advertisement.php";

			document.getElementById("ADVERtise").submit();

			

		}

	}

	/*if(document.getElementById("ADVERtise") != null)

	{

		document.getElementById("ADVERtise").action="advertisement.php";

		document.getElementById("ADVERtise").submit();

	}*/



}

function showLOaDing(argId)

{

	//alert(argId)

	if(document.getElementById("inPUTbuTTOn") != null)

	{

		//alert("sdfdsfds");

		if(document.getElementById(argId) != null)

		{

			document.getElementById(argId).style.display = '';

		}

		/*if(document.getElementById("step3") != null && document.getElementById("step3").style.display != 'none')

		{

			document.getElementById("inPUTbuTTOn").innerHTML='<input type="submit" name="contiNue" id="contiNue" value="Submit" />';

		}

		else*/

		document.getElementById("inPUTbuTTOn").innerHTML='<input type="button" name="contiNue" id="contiNue" value="Continue" onclick="return CheckValidationFORstep1();" />';

	}

}



function checkDomain(nname)

{

var arr = new Array(

'.com','.net','.org','.biz','.coop','.info','.museum','.name',

'.pro','.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag',

'.ai','.al','.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw',

'.az','.ba','.bb','.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm',

'.bn','.bo','.br','.bs','.bt','.bv','.bw','.by','.bz','.ca','.cc',

'.cd','.cf','.cg','.ch','.ci','.ck','.cl','.cm','.cn','.co','.cr',

'.cu','.cv','.cx','.cy','.cz','.de','.dj','.dk','.dm','.do','.dz',

'.ec','.ee','.eg','.eh','.er','.es','.et','.fi','.fj','.fk','.fm',

'.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh','.gi','.gl','.gm',

'.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy','.hk','.hm',

'.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io','.iq',

'.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',

'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li',

'.lk','.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg',

'.mh','.mk','.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt',

'.mu','.mv','.mw','.mx','.my','.mz','.na','.nc','.ne','.nf','.ng',

'.ni','.nl','.no','.np','.nr','.nu','.nz','.om','.pa','.pe','.pf',

'.pg','.ph','.pk','.pl','.pm','.pn','.pr','.ps','.pt','.pw','.py',

'.qa','.re','.ro','.rw','.ru','.sa','.sb','.sc','.sd','.se','.sg',

'.sh','.si','.sj','.sk','.sl','.sm','.sn','.so','.sr','.st','.sv',

'.sy','.sz','.tc','.td','.tf','.tg','.th','.tj','.tk','.tm','.tn',

'.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug','.uk','.um',

'.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu','.ws',

'.wf','.ye','.yt','.yu','.za','.zm','.zw');



var mai = nname;

var val = true;



var RETUrnMessage='success';



var dot = mai.lastIndexOf(".");

var dname = mai.substring(0,dot);

var ext = mai.substring(dot,mai.length);

//alert('mai===='+mai+'ext==='+ext+'dot===='+dot+'dname===='+dname);

//alert('ext==='+ext);

//alert('dot===='+dot);

//alert('dname===='+dname);



if(dot>2 && dot<57)

{

	for(var i=0; i<arr.length; i++)

	{

	  if(ext == arr[i])

	  {

	 	val = true;

		break;

	  }	

	  else

	  {

	 	val = false;

	  }

	}

	if(val == false)

	{

	  	 //alert("Your domain extension "+ext+" is not correct");

		 //RETUrnMessage="Your domain extension "+ext+" is not correct";

		 //return RETUrnMessage;

		 //return false;

	}

	else

	{

		for(var j=0; j<dname.length; j++)

		{

		  var dh = dname.charAt(j);

		  var hh = dh.charCodeAt(0);

		  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh==45 || hh==46)

		  {

			 if((j==0 || j==dname.length-1) && hh == 45)	

		  	 {

		 	  	 //alert("Domain name should not begin are end with '-'");

			      //return false;

				  RETUrnMessage="Domain name should not begin are end with '-'";

		 		  //return RETUrnMessage;

		 	 }

		  }

		else	{

		  	 //alert("Your domain name should not have special characters");

			 //return false;

			 RETUrnMessage="Your domain name should not have special characters";

		 	 //return RETUrnMessage;

		  }

		}

	}

}

else

{

 //alert("Your Domain name is too short/long");

 //return false;

	RETUrnMessage="Your domain name should not have special characters";

	//return RETUrnMessage;

}	

return RETUrnMessage

//return true;

}



/**************************************************************************CODE FOR DISPLAY IMAGE START FROM HERE*****************************************************/

function RAND()

{

	if(ARRAYPoSItiON >= BAnnerVeriablesARRay.length)

	{

		ARRAYPoSItiON=0;

		/*if(BAnnerVeriablesARRay2[ARRAYPoSItiON] == '')

		{

			TEmpVarLINK='#';

		}

		else

		{

			TEmpVarLINK=BAnnerVeriablesARRay2[ARRAYPoSItiON];

		}*/

		if(BAnnerVeriablesARRay5[ARRAYPoSItiON] == '')

		{

			VARCAPtureID=0;

		}

		else

		{

			VARCAPtureID=BAnnerVeriablesARRay5[ARRAYPoSItiON];

		}

		if(BAnnerVeriablesARRay[ARRAYPoSItiON] == '')

		{

			TEmpVarIMAGE='';

		}

		else

		{

			

			//TEmpVarIMAGE='<a href="'+TEmpVarLINK+'"><img src="'+BAnnerVeriablesARRay[ARRAYPoSItiON]+'" border="0"   /></a>';

			TEmpVarIMAGE='<a href="javascript:updateFunction(\''+VARCAPtureID+'\');" style=" color:#7E7E7E; font-weight:normal;" class="nametxt"><img src="'+BAnnerVeriablesARRay[ARRAYPoSItiON]+'" border="0"   /></a>';

		}

		//VARSTrinG='<a href="'+TEmpVarLINK+'"><span style="text-align:justify;">'+BAnnerVeriablesARRay3[ARRAYPoSItiON]+'</span></a><br>'+TEmpVarIMAGE+'<br><span style="text-align:left;align:left;">'+BAnnerVeriablesARRay4[ARRAYPoSItiON]+'</span>';

		VARSTrinG='<a href="javascript:updateFunction(\''+VARCAPtureID+'\');"><span style="text-align:justify; color:#7E7E7E; font-weight:normal;" class="nametxt">'+BAnnerVeriablesARRay3[ARRAYPoSItiON]+'</span></a><br>'+TEmpVarIMAGE+'<br><span style="text-align:left;align:left; color:#7E7E7E; font-weight:normal;" class="nametxt">'+BAnnerVeriablesARRay4[ARRAYPoSItiON]+'</span>';

		document.getElementById("Rotate").innerHTML=VARSTrinG;

		ARRAYPoSItiON++;

		setTimeout("RAND('"+ARRAYPoSItiON+"')",4000);

	}

	else

	{

		/*if(BAnnerVeriablesARRay2[ARRAYPoSItiON] == '')

		{

			TEmpVarLINK='#';

		}

		else

		{

			TEmpVarLINK=BAnnerVeriablesARRay2[ARRAYPoSItiON];

		}*/

		if(BAnnerVeriablesARRay5[ARRAYPoSItiON] == '')

		{

			VARCAPtureID=0;

		}

		else

		{

			VARCAPtureID=BAnnerVeriablesARRay5[ARRAYPoSItiON];

		}

		if(BAnnerVeriablesARRay[ARRAYPoSItiON] == '')

		{

			TEmpVarIMAGE='';

		}

		else

		{

			TEmpVarIMAGE='<a href="javascript:updateFunction(\''+VARCAPtureID+'\');" style=" color:#7E7E7E; font-weight:normal;" class="nametxt"><img src="'+BAnnerVeriablesARRay[ARRAYPoSItiON]+'" border="0"   /></a>';

			//TEmpVarIMAGE='<a href="'+TEmpVarLINK+'"><img src="'+BAnnerVeriablesARRay[ARRAYPoSItiON]+'" border="0"   /></a>';

		}

		VARSTrinG='<a href="javascript:updateFunction(\''+VARCAPtureID+'\');"><span style="text-align:justify; color:#7E7E7E; font-weight:normal;" class="nametxt">'+BAnnerVeriablesARRay3[ARRAYPoSItiON]+'</span></a><br>'+TEmpVarIMAGE+'<br><span style="text-align:justify; color:#7E7E7E; font-weight:normal;" class="nametxt">'+BAnnerVeriablesARRay4[ARRAYPoSItiON]+'</span>';

		//VARSTrinG='<a href="'+TEmpVarLINK+'"><span style="text-align:justify;">'+BAnnerVeriablesARRay3[ARRAYPoSItiON]+'</span></a><br>'+TEmpVarIMAGE+'<br><span style="text-align:justify;">'+BAnnerVeriablesARRay4[ARRAYPoSItiON]+'</span>';

		document.getElementById("Rotate").innerHTML=VARSTrinG;

		ARRAYPoSItiON++;

		setTimeout("RAND('"+ARRAYPoSItiON+"')",4000);

	}

}



/*---------------------------------------------------------------------------------------------------------------------------------------------------------------*/

function bannerRightWithOutRotate()

{

	var INNERhtml='';

	for(var ARRAYPoSItiON=0; ARRAYPoSItiON<BAnnerVeriablesARRay.length; ARRAYPoSItiON++)

	{

		/*if(BAnnerVeriablesARRay2[ARRAYPoSItiON] == '')

		{

			TEmpVarLINK='#';

		}

		else

		{

			TEmpVarLINK=BAnnerVeriablesARRay2[ARRAYPoSItiON];

		}*/

		if(BAnnerVeriablesARRay5[ARRAYPoSItiON] == '')

		{

			VARCAPtureID=0;

		}

		else

		{

			VARCAPtureID=BAnnerVeriablesARRay5[ARRAYPoSItiON];

		}

		if(BAnnerVeriablesARRay[ARRAYPoSItiON] == '')

		{

			TEmpVarIMAGE='';

		}

		else

		{

			TEmpVarIMAGE='<a href="javascript:updateFunction(\''+VARCAPtureID+'\');" style=" color:#7E7E7E; font-weight:normal;" class="nametxt"><img src="'+BAnnerVeriablesARRay[ARRAYPoSItiON]+'" border="0"   /></a>';

			//TEmpVarIMAGE='<a href="'+TEmpVarLINK+'"><img src="'+BAnnerVeriablesARRay[ARRAYPoSItiON]+'" border="0"   /></a>';

		}

		

		INNERhtml=INNERhtml + '<div style="height:230px; width:auto; border:#FF9000 2px groove;"><a href="javascript:updateFunction(\''+VARCAPtureID+'\');"><span style="text-align:justify; color:#7E7E7E; font-weight:normal;" class="nametxt">'+BAnnerVeriablesARRay3[ARRAYPoSItiON]+'</span></a><br>'+TEmpVarIMAGE+'<br><span style="text-align:justify;">'+BAnnerVeriablesARRay4[ARRAYPoSItiON]+'</span></div><br>';

		

		//INNERhtml=INNERhtml + '<div style="height:230px; width:auto; border:#FF9000 2px groove;"><a href="'+TEmpVarLINK+'"><span style="text-align:justify;">'+BAnnerVeriablesARRay3[ARRAYPoSItiON]+'</span></a><br>'+TEmpVarIMAGE+'<br><span style="text-align:justify;">'+BAnnerVeriablesARRay4[ARRAYPoSItiON]+'</span></div><br>';

	}

	document.getElementById("NOTRotate").innerHTML=INNERhtml;

}







/**************************************************************************CODE FOR DISPLAY IMAGE ENDS HERE*****************************************************/

function PRIcetaB(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)

{
	//alert(arg1+','+arg2+','+arg3+','+arg4+','+arg5+','+arg6+','+arg7+','+arg8);

	//alert(document.getElementById(arg1)+'---'+document.getElementById(arg2)+'---'+document.getElementById(arg3)+'---'+document.getElementById(arg4))

	if(arg1 == 'PAyForVIEWs_INFo')

	{

		if(document.getElementById('cpc_bid_value').value != null)

		{

			if(document.getElementById('COSTperVIEw') != null)

			{

				//document.getElementById('cpc_bid_value').value=document.getElementById('COSTperVIEw').value;

			}

			//document.getElementById('cpc_bid_value').value='0.09';

		}

		if(document.getElementById('DAILYlimitS') != null)

		{

			if(document.getElementById('DAILybuDgetPerVIEw') != null)

			{

				//document.getElementById('DAILYlimitS').innerHTML='hjhjh';

			}

		}

		if(document.getElementById('BIDtyPE') != null)

		{

			document.getElementById('BIDtyPE').value='CPM in Ad Space';

		}

		

	}

	else

	{

		if(document.getElementById('cpc_bid_value').value != null)

		{

			if(document.getElementById('COSTperClicK') != null)

			{

				//document.getElementById('cpc_bid_value').value=document.getElementById('COSTperClicK').value;

			}

			//document.getElementById('cpc_bid_value').value='0.19';

		}

		if(document.getElementById('DAILYlimitS') != null)

		{

			if(document.getElementById('DAILybuDgetPerCLIck') != null)

			{

				//document.getElementById('DAILYlimitS').innerHTML='oooo';

			}

		}

		if(document.getElementById('BIDtyPE') != null)

		{

			document.getElementById('BIDtyPE').value='CPC';

		}

	}

	if(document.getElementById(arg1) != null)

	{

		document.getElementById(arg1).style.display='';

	}

	if(document.getElementById(arg2) != null)

	{

		document.getElementById(arg2).style.display='';

	}

	if(document.getElementById(arg3) != null)

	{

		document.getElementById(arg3).style.display='';

	}

	if(document.getElementById(arg4) != null)

	{

		document.getElementById(arg4).style.display='none';

	}

	if(document.getElementById(arg5) != null)

	{

		document.getElementById(arg5).style.display='none';

	}

	if(document.getElementById(arg6) != null)

	{

		document.getElementById(arg6).style.display='none';

	}

	if(document.getElementById(arg7) != null)

	{

		document.getElementById(arg7).className='SElecTEd';

	}

	if(document.getElementById(arg8) != null)

	{

		document.getElementById(arg8).className='NotSElecTEd';

	}

}



/*function displayINNERhtML(arg1,arg2,arg3)

{

	if(document.getElementById(arg1) != null)

	{

		if(document.getElementById(arg1).checked == true)

		{

			if(document.getElementById(arg2) != null && document.getElementById(arg3) != null )

			{

				document.getElementById(arg2).style.display='none';

				document.getElementById(arg3).style.display='';

			}

		}

	}

}*/



function displayDateChoice(arg1,arg2,arg3)

{

	if(document.getElementById(arg1) != null)

	{

		if(document.getElementById(arg1).checked == true)

		{

			/*if(document.getElementById(arg1).value == "y")

			{

				if(document.getElementById("BIDtyPE") != null)

				{

					document.getElementById("BIDtyPE").value='CPC';

				}

			}

			else if(document.getElementById(arg1).value == "n")

			{

				if(document.getElementById("BIDtyPE") != null)

				{

					document.getElementById("BIDtyPE").value='CPM in Ad Space';

				}

			}*/

			if(document.getElementById(arg2) != null && document.getElementById(arg3) != null )

			{

				document.getElementById(arg2).style.display='none';

				document.getElementById(arg3).style.display='';

			}

		}

	}

}





function RETUrnSETday(arg1,arg2,arg3,arg4)

{

	/*alert(document.getElementById(arg1));

	if(document.getElementById(arg1) != null)

	{*/

		var VAlueTEmp=arg1;//document.getElementById(arg1).value;

		//alert(VAlueTEmp);

		if(VAlueTEmp == 1 || VAlueTEmp == 3 || VAlueTEmp == 5 || VAlueTEmp == 7 || VAlueTEmp == 8 || VAlueTEmp == 10 || VAlueTEmp == 12)

		{

			if(document.getElementById(arg3) != null)

			{

				document.getElementById(arg3).innerHTML='<select name="'+arg2+'" id="'+arg2+'" autocomplete="off"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option></select>';

			}

		}

		else if(VAlueTEmp == 2 )

		{

			if(document.getElementById(arg4) != null)

			{

				var VAlueTEmpYEAR=document.getElementById(arg4).value;

				//alert("year=="+VAlueTEmpYEAR);

				if(parseInt(VAlueTEmpYEAR % 2) == 0)

				{

					

					if(document.getElementById(arg3) != null)

					{

						document.getElementById(arg3).innerHTML='<select name="'+arg2+'" id="'+arg2+'" autocomplete="off"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option></select>';

					}

				}

				else

				{

					if(document.getElementById(arg3) != null)

					{

						document.getElementById(arg3).innerHTML='<select name="'+arg2+'" id="'+arg2+'" autocomplete="off"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option></select>';

					}



				}

			}

		}

		else

		{

			if(document.getElementById(arg3) != null)

			{

				document.getElementById(arg3).innerHTML='<select name="'+arg2+'" id="'+arg2+'" autocomplete="off"><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option></select>';

			}

			

		}

	//}

	

}







function updateFunction(ARGUMEnt1)

{

	mywindow = window.open("ServerUpdates.php?GETid="+ARGUMEnt1,"mywindow","width=1024,height=800,status=0,toolbar=0,menubar=0,resizable=1,dependent=0,left=120,top=120,scrollbars=yes");

	//mywindow.moveTo(300,150);



}







function CHEckEnable(id,submitId)

{

	if(document.getElementById(id) != null)

	{

		var temPVAluE='';

		if(document.getElementById(submitId) != null)

		{

			temPVAluE=document.getElementById(submitId).value;

		}

		if(document.getElementById(id).checked == true)

		{

			if(document.getElementById('BUTTN_'+temPVAluE) != null)

			{

				//alert('BUTTN_'+temPVAluE)

				document.getElementById('BUTTN_'+temPVAluE).disabled=false;

			}

		}

		else

		{

			if(document.getElementById('BUTTN_'+temPVAluE) != null)

			{

				document.getElementById('BUTTN_'+temPVAluE).disabled=true;

			}		

		}

	}

}



/**************************************************************** CHECK ALL STARTS FROM HERE ***************************************************************/

var CLICKSTAte=0.00;

var CLICKPAge=0.00;

var VIEWSTAte=0.00;

var VIEWPAge=0.00;



function CheCkAll(thisId,others,minID,maxID)

{

	var MInID='';

	var MAxID='';

	if(document.getElementById(minID) != null)

	{

		MInID=document.getElementById(minID).value;

	}

	else

	{

		MInID=0;

	}

	if(document.getElementById(maxID) != null)

	{

		MAxID=document.getElementById(maxID).value;

	}

	else

	{

		MAxID=0;

	}

	if(document.getElementById(thisId) != null)

	{

		

		if(document.getElementById(thisId).checked == true)

		{

			for(var i=MInID; i<=MAxID; i++)

			{

				if(document.getElementById(others+i) != null)

				{

					if(document.getElementById(others+i).disabled == false)

					{

						document.getElementById(others+i).checked =true;

					}

				}

			}

			if(others == 'state')

			{





				if(document.getElementById("totalCLICKState") != null )

				{

					document.getElementById("totalCLICKState").value=parseFloat(document.getElementById("COST_CLICK_ALL_STATE").value);

					CLICKSTAte=parseFloat(document.getElementById("COST_CLICK_ALL_STATE").value);

				}

				

				if(document.getElementById("totalVIEWState") != null )

				{

					document.getElementById("totalVIEWState").value=parseFloat(document.getElementById("COST_VIEW_ALL_STATE").value);

					VIEWSTAte=parseFloat(document.getElementById("COST_VIEW_ALL_STATE").value);

				}

			}

			else

			{

				if(document.getElementById("totalCLICKPage") != null )

				{

					document.getElementById("totalCLICKPage").value=parseFloat(document.getElementById("COST_CLICK_ALL_PAGE").value);

					CLICKPAge=parseFloat(document.getElementById("COST_CLICK_ALL_PAGE").value);

				}

				

				if(document.getElementById("totalVIEWPage") != null )

				{

					document.getElementById("totalVIEWPage").value=parseFloat(document.getElementById("COST_VIEW_ALL_PAGE").value);

					VIEWPAge=parseFloat(document.getElementById("COST_VIEW_ALL_PAGE").value);

				}

			}

		}

		else

		{

			for(var i=MInID; i<=MAxID; i++)

			{

				if(document.getElementById(others+i) != null)

				{

					if(document.getElementById(others+i).disabled == false)

					{

						document.getElementById(others+i).checked =false;

					}

				}

			}

			if(others == 'state')

			{





				if(document.getElementById("totalCLICKState") != null )

				{

					document.getElementById("totalCLICKState").value=0.00;

				}

				

				if(document.getElementById("totalVIEWState") != null )

				{

					document.getElementById("totalVIEWState").value=0.00;

				}

			}

			else

			{

				if(document.getElementById("totalCLICKPage") != null )

				{

					document.getElementById("totalCLICKPage").value=0.00;

				}

				

				if(document.getElementById("totalVIEWPage") != null )

				{

					document.getElementById("totalVIEWPage").value=0.00;

				}

			}

			

		}

	}

	updateALL(thisId,others);

	

}





function updateALL(GTEtheID__,others)

{

	if(document.getElementById("BIDtyPE") != null && document.getElementById("BIDtyPE").value == 'CPC')

	{

		

		if(document.getElementById("cpc_bid_value").value != null)

		{

			document.getElementById("cpc_bid_value").value=parseFloat(parseFloat(document.getElementById("totalCLICKState").value) + parseFloat(document.getElementById("totalCLICKPage").value));

		}

		if(document.getElementById("COSTperClick") != null)

		{

			document.getElementById("COSTperClick").value=parseFloat(parseFloat(document.getElementById("totalCLICKState").value) + parseFloat(document.getElementById("totalCLICKPage").value));

		}

		if(document.getElementById("COSTperView") != null)

		{

			document.getElementById("COSTperView").value=parseFloat(parseFloat(document.getElementById("totalVIEWState").value) + parseFloat(document.getElementById("totalVIEWPage").value));

		}

	}

	else if(document.getElementById("BIDtyPE") != null && document.getElementById("BIDtyPE").value != 'CPC')

	{

		

		if(document.getElementById("cpc_bid_value").value != null)

		{

			document.getElementById("cpc_bid_value").value=parseFloat(parseFloat(document.getElementById("totalVIEWState").value) + parseFloat(document.getElementById("totalVIEWPage").value));

		}

		if(document.getElementById("COSTperView") != null)

		{

			document.getElementById("COSTperView").value=parseFloat(parseFloat(document.getElementById("totalVIEWState").value) + parseFloat(document.getElementById("totalVIEWPage").value));

		}

		

		if(document.getElementById("COSTperClick") != null)

		{

			document.getElementById("COSTperClick").value=parseFloat(parseFloat(document.getElementById("totalCLICKState").value) + parseFloat(document.getElementById("totalCLICKPage").value));

		}

			

			

							

	}

}





function CHEckoNE(thisId,checKAllID,minID,maxID,TOTAlroWS,others)

{

	var MInID='';

	var MAxID='';

	var TOTalroWS='';

	var TEMpcouNTer=0;

	if(document.getElementById(minID) != null)

	{

		MInID=document.getElementById(minID).value;

	}

	else

	{

		MInID=0;

	}

	if(document.getElementById(maxID) != null)

	{

		MAxID=document.getElementById(maxID).value;

	}



	else

	{

		MAxID=0;

	}

	if(document.getElementById(TOTAlroWS) != null)

	{

		TOTalroWS=document.getElementById(TOTAlroWS).value;

	}

	else

	{

		TOTalroWS=0;

	}

	if(document.getElementById(thisId) != null)

	{

		

		if(document.getElementById(thisId).checked == true)

		{

			document.getElementById(thisId).checked = true;

		}

		else

		{

			document.getElementById(thisId).checked = false;

		}

	}

	if(document.getElementById(checKAllID) != null && document.getElementById(checKAllID).checked == true)

	{

		//alert(" sldfdsflk dsjlf kjsdfds");

		document.getElementById(checKAllID).checked = false;

		if(others == 'state')

		{

			CLICKSTAte=0.00;

			VIEWSTAte=0.00;

		}

		else

		{

			CLICKPAge=0.00;

			VIEWPAge=0.00;

		}



	}

	for(var i=MInID; i<=MAxID; i++)

	{

		if(document.getElementById(others+i) != null)

		{

			if(document.getElementById(others+i).checked == true )

			{

				TEMpcouNTer++;

			}

		}

	}

	

	//alert(TEMpcouNTer);

	if(TEMpcouNTer != 0 )

	{

		//alert(TEMpcouNTer);

		//alert(others);

		if(others == 'state')

		{

			//alert("sadlasdklsa");

			CLICKSTAte=parseFloat(parseInt(TEMpcouNTer) * parseFloat(document.getElementById("COST_CLICK_PER_STATE").value));

			VIEWSTAte=parseFloat(parseInt(TEMpcouNTer) * parseFloat(document.getElementById("COST_VIEW_PER_STATE").value));

			

			//alert(CLICKSTAte);alert(VIEWSTAte);

		}

		else

		{

			//alert(CLICKSTAte)

			CLICKPAge=parseFloat(parseInt(TEMpcouNTer) * parseFloat(document.getElementById("COST_CLICK_PER_PAGE").value));

			VIEWPAge=parseFloat(parseInt(TEMpcouNTer) * parseFloat(document.getElementById("COST_VIEW_PER_PAGE").value));

		}



	}

	

	if(TEMpcouNTer == TOTalroWS)

	{

		if(document.getElementById(checKAllID) != null && document.getElementById(checKAllID).checked == false)

		{

			document.getElementById(checKAllID).checked = true;

		}

		

		if(others == 'state')

			{

			if(document.getElementById("totalCLICKState") != null )

			{

				document.getElementById("totalCLICKState").value=parseFloat(document.getElementById("COST_CLICK_ALL_STATE").value);

			}

			

			if(document.getElementById("totalVIEWState") != null )

			{

				document.getElementById("totalVIEWState").value=parseFloat(document.getElementById("COST_VIEW_ALL_STATE").value);

			}

		}

		else

		{

			if(document.getElementById("totalCLICKPage") != null )

			{

				document.getElementById("totalCLICKPage").value=parseFloat(document.getElementById("COST_CLICK_ALL_PAGE").value);

			}

			

			if(document.getElementById("totalVIEWPage") != null )

			{

				document.getElementById("totalVIEWPage").value=parseFloat(document.getElementById("COST_VIEW_ALL_PAGE").value);

			}

		}			

	}

	else

	{

		//alert("sdfsdfdsf");

		if(document.getElementById("totalCLICKState") != null )

		{

			//alert(parseFloat(CLICKSTAte))

			document.getElementById("totalCLICKState").value=parseFloat(CLICKSTAte);

		}

		

		if(document.getElementById("totalVIEWState") != null )

		{

			document.getElementById("totalVIEWState").value=parseFloat(VIEWSTAte);

		}

		

		if(document.getElementById("totalCLICKPage") != null )

		{

			document.getElementById("totalCLICKPage").value=parseFloat(CLICKPAge);

		}

		

		if(document.getElementById("totalVIEWPage") != null )

		{

			document.getElementById("totalVIEWPage").value=parseFloat(VIEWPAge);

		}

		

	}

	updateCLIck(thisId,others);

}







function updateCLIck(THEid__,others)

{

	/*if(others == 'state')

	{

		if(document.getElementById("BIDtyPE") != null && document.getElementById("BIDtyPE").value == 'CPC')

		{

			if(document.getElementById("cpc_bid_value") != null)

			{

				document.getElementById("cpc_bid_value").value=parseFloat(document.getElementById("totalCLICKState").value);

			}

			if(document.getElementById("COSTperClick") != null)

			{

				document.getElementById("COSTperClick").value=parseFloat(document.getElementById("totalCLICKState").value);

			}



			if(document.getElementById("COSTperView") != null)

			{

				document.getElementById("COSTperView").value=parseFloat(document.getElementById("totalVIEWPage").value);

			}

		}

		else if(document.getElementById("BIDtyPE") != null && document.getElementById("BIDtyPE").value != 'CPC')

		{

			if(document.getElementById("cpc_bid_value") != null)

			{

				document.getElementById("cpc_bid_value").value=parseFloat(document.getElementById("totalVIEWState").value);

			}

			if(document.getElementById("COSTperView") != null )

			{

				document.getElementById("COSTperView").value=parseFloat(document.getElementById("totalVIEWState").value);

			}



			if(document.getElementById("COSTperClick") != null)

			{

				document.getElementById("COSTperClick").value=parseFloat(document.getElementById("totalCLICKState").value);

			}

		}

	}

	else

	{

		

	}

*/

	if(document.getElementById("BIDtyPE") != null && document.getElementById("BIDtyPE").value == 'CPC')

	{

		if(document.getElementById("cpc_bid_value").value != null )

		{

			document.getElementById("cpc_bid_value").value=parseFloat(parseFloat(document.getElementById("totalCLICKState").value) + parseFloat(document.getElementById("totalCLICKPage").value));

		}

		if(document.getElementById("COSTperClick") != null)

		{

			document.getElementById("COSTperClick").value=parseFloat(parseFloat(document.getElementById("totalCLICKState").value) + parseFloat(document.getElementById("totalCLICKPage").value));

		}





		if(document.getElementById("COSTperView") != null )

		{

			document.getElementById("COSTperView").value=parseFloat(parseFloat(document.getElementById("totalVIEWState").value) + parseFloat(document.getElementById("totalVIEWPage").value));

		}

			

	}

	else if(document.getElementById("BIDtyPE") != null && document.getElementById("BIDtyPE").value != 'CPC')

	{

		if(document.getElementById("cpc_bid_value").value != null)

		{

			document.getElementById("cpc_bid_value").value=parseFloat(parseFloat(document.getElementById("totalVIEWState").value) + parseFloat(document.getElementById("totalVIEWPage").value));

		}

		if(document.getElementById("COSTperView") != null)

		{

			document.getElementById("COSTperView").value=parseFloat(parseFloat(document.getElementById("totalVIEWState").value) + parseFloat(document.getElementById("totalVIEWPage").value));

		}

		

		if(document.getElementById("COSTperClick") != null)

		{

			document.getElementById("COSTperClick").value=parseFloat(parseFloat(document.getElementById("totalCLICKState").value) + parseFloat(document.getElementById("totalCLICKPage").value));

		}

	}



}











function checkAll(arg1, arg2)

{

	var job_Id = '';

	if(document.getElementById("check_all").checked == true)

	{

		var i = 0;

		for(i=arg2;i<=arg1;i++)

		{

			if(document.getElementById("check"+i) != null && document.getElementById("check"+i).disabled == false)

			{

				document.getElementById("check"+i).checked = true;

				job_Id += i+',';

				var flag = 1;

			}

		}

		if(flag == 1)

		{

			document.getElementById("apply_all").disabled = false;

		}

	}

	else

	{

		for(var i=arg2;i<=arg1;i++)

		{

			if(document.getElementById("check"+i) != null && document.getElementById("check"+i).disabled == false)

			{

				document.getElementById("check"+i).checked = false;

				job_Id += i+',';

				var flag = 1;

			}

		}

		if(flag == 1)

		{

			document.getElementById("apply_all").disabled = true;

		}

	}

	//alert(document.getElementById("job_id").value);

}

function check_one(arg1,arg2,arg3,arg4)

{

	var job_Id = '';

	if(document.getElementById("check"+arg1) != null)

	{

		document.getElementById("apply_all").disabled = false;

	}

	var flag = '';

	for(var i=arg2;i<=arg3;i++)

	{

		if(document.getElementById("check"+i) != null)

		{

			if(document.getElementById("check"+i).checked == false)

			{

				if(i == arg2)

				{

					flag = 1;

				}

				else

					flag++;

				document.getElementById("check_all").checked = false;

			}

			else

			{

				job_Id += i+',';

			}

		}

	}

	if(flag == arg4)

	{

		document.getElementById("apply_all").disabled = true;

	}

	//alert(document.getElementById("job_id").value);

}





/**************************************************************** CHECK ALL ENDS HERE ***************************************************************/






