// -------------------------------------------------------------

// -------------------  function amount() { 

// -------------------------------------------------------------



 function amount() {       
   with(document.forms[0]) {
	var i, value;
	var amount=0, amount_1 = 0, amount_2 = 0, amount_1_2 = 0;
	
	for(i = 4; i <= 14; i++) {				   // for(i = 0; i < prices.length; i++) {	
   		 if( elements[i].checked) { 
			// amount += eval( elements[i].value)/2 * 5;	 
			value = (elements[i].value)
			
			
			
			if(value == 100){ amount = 2.99;  }
			else if(value == 150){ amount = 4.49;  }
			else if(value == 200){ amount = 5.99; }
			else if(value == 250){ amount = 7.49; }
			else if(value == 300){ amount = 8.99; }
			else if(value == 350){ amount = 10.49; }
			else if(value == 400){ amount = 11.99; }
			else if(value == 450){ amount = 13.49; }
			else if(value == 500){ amount = 14.99; }
			else if(value == 550){ amount = 16.49; }
			else if(value == 600){ amount = 17.99; }
			else{}
						
		}
	}	
	
	
	if( elements[15].selectedIndex != 0) {
	
		amount_1 = eval( elements[15].selectedIndex) ;	  //
			// alert("7 Here "  + amount_1 );

		if(amount_1 ==  1) {
			amount_1 = 50;				
			// alert("Here " +  " " + amount_1 );
		}
		/* 
		
		else if(amount_1 == 2) {
			amount_1 = 25;				
			// alert("Here "  + " " + amount_1 );
		 }
		 
		 */
	}

	if( elements[16].selectedIndex != 0) {
		amount_2 = eval( elements[16].selectedIndex) ;	  //
			  // alert("9 Here1 "  + amount_2 );		
	}

	
	if( elements[15].selectedIndex != 0 && elements[16].selectedIndex != 0) {	
		
		amount_1_2 = amount_1 * amount_2
		
		 // alert("Mult Here " +  amount_1_2);	
	
		if(amount_1_2 > 0 && amount_1_2 <= 50) {
			amount += 0.99;
		}
		else if(amount_1_2 > 50 && amount_1_2 <= 100) {
			amount += 1.99;	
		}
		else if(amount_1_2 > 100 && amount_1_2 <= 150) {
			amount += 2.99;	
		}		
		else if(amount_1_2 > 150 && amount_1_2 <= 200) {
			amount += 3.99;	
		}
		else if(amount_1_2 > 200 && amount_1_2 <= 250) {
			amount += 4.99;	
		}		
		else if(amount_1_2 > 250 && amount_1_2 <= 300) {
			amount += 5.99;	
		}				
		else{}
		
		// alert("Add Here " +  " " +  amount + " , " + amount_1 + " , " + amount_2);		
	}							

	// for input tag
	// total.value = amount;		

  // with
  } 
      	
	var total = document.getElementById("total");
	replaceText(total, amount.toFixed(2));

// function
} 

// -------------------------------------------------------------

// -------------------  function replaceText(el, text ) {

// -------------------------------------------------------------

	function replaceText(el, text ) {
	

		if(el != null) {
			clearText(el);
			var newNode = document.createTextNode(text);
			el.appendChild(newNode);
		}
		
	// function
	}
		
// -------------------------------------------------------------
	
// -------------------  function clearText(el) {
		
// -------------------------------------------------------------
		
	function clearText(el) {
	
	var i, childNode;
	
		if(el != null) {
			if(el.childNodes) {
				for (i=0; i < el.childNodes.length; i++) {
					childNode = el.childNodes[i];
					// if(childNode ne "Total:") {
						el.removeChild(childNode) ;
					// }
				}
			}
		}
		
	// function
	}
	
// -------------------------------------------------------------
	
// --------------------	function getText(el) {
	
// -------------------------------------------------------------
	
	function getText(el) {
	
	var i, childNode;
	var text= "";

		if(el != null) {		
			if(el.childNodes) {
				for (i=0; i < el.childNodes.length; i++) {
					childNode = el.childNodes[i];
					if(childNode.nodeValue != null) {
						text = text + childNode.nodeValue;
					}
				}
			}
		}
		return(text);
	// function
	}

// -------------------------------------------------------------

// -------------------  function count_recs() { 

// -------------------------------------------------------------

 function count_recs(limit) {       
	   
	   var i = 0, count = 0;
	   var recs = new Array();
	   var thetext = document.forms[0].elements[0].value;
	   
	   recs = thetext.split("\n");
	   
 	  
	   for(i; i < recs.length; i++) {
		   if(recs[i].match(/^http:\/\//)) {
			   count++;
				// alert("count: " + count + " limit: " + limit );
			   
			   if(count > limit) {
					alert("You are allowed " + limit + " urls." );
					return false;				   
		   		}
			}
			else
			{
				alert("Please enter ONE url per line." );
				return false;
			}
			
		
		  
		}
	


	

	  // function
 }
 
// -------------------------------------------------------------

// -------------------  function count_recs1() { 

// -------------------------------------------------------------

 function count_recs1(limit) {       
	   
	   // var i = 0, count = 0;
	   var recs = new Array();
	   var thetext = document.forms[0].elements[0].value;
	   
	   recs = thetext.split("\n");
	   
 
	// alert(recs.length + " entered." );
	if(recs.length-1 > limit || recs.length <= 1 ){
		// alert("You are allowed " + limit + " urls. " + recs.length + " entered." );
		alert("You are allowed " + limit + " urls." );
		return false;
	}
	else
	{	
		// alert("You have submitted " + recs.length + " urls.");
		return true;
	}
	

	  // function
 }
 
 
// -------------------------------------------------------------

// -------------------  function gathering() { 

// -------------------------------------------------------------


 function gathering() {       
	   
	links.style.visibility = "visible";  
	return true;

 }
 
 
 // -------------------  function gathering1() { 

// No

 function gathering1() {       
	   
	 //// document.write("<div id='links' STYLE='visibility:visible;position:absolute;top:150px; left:300px;'>);
	 document.write("<div id='links' STYLE='font-family:Microsoft Sans Serif; visibility:visible; position:absolute; top:150px; left:300px;'>");
	 
	 document.write("<p align='center'>LinkICE is gathering your links.<br />This may take a few minutes<br /><br />");
	  document.write("<p align='center'><img src='../../LinkICE/images/working.gif' /> </p>");
	  //// document.write("<p align='center'><img src='./images/working.gif' /> </p>");
	  document.write("</div>");

	  // alert("LinkICE is gathering your links.\nThis may take a few minutes.");
	  return true;

 }
 
 
// -------------------------------------------------------------

// -------------------  function disab() { 

// ------------------------------------------------------------- 
 
// usage onsubmit="disab(1)"

 function disab (val) {

		// if(val=="1") {form1.Submit.disabled=true}
		if(val=="1") {document.forms[0].submit.disabled=true}
		return true;

 }

 
// -------------------------------------------------------------

// -------------------  function val_email() { 

// ------------------------------------------------------------- 
 
//  onsubmit="javascript:return val_email();" 
// 	onSubmit="javascript:return OnSubmit=val_email();"
// elements[3] - elements[3] on 127

 function val_email () {
	
	 with (document.forms[0]) {
		 
	 	// var theemail = elements[3].value;
	 	var theemail = email_report.value;
	 	
	 	
	 	// var thegeo1 = elements[4].options[elements[4].selectedIndex].value;
	 	var thegeo1 = geo1.options[geo1.selectedIndex].value;
	 	
	   // var thegeo2 = elements[5].options[elements[5].selectedIndex].value;
	   var thegeo2 = geo2.options[geo2.selectedIndex].value;
	   
	   // var thesec = elements[6].options[elements[6].selectedIndex].value;
	   var thesec = sector.options[sector.selectedIndex].value;
	   
	   
	   var count = 0;
	   
	    
		if( theemail.match(/\@/) ) {
 			// return true;
 			count++;
		}
		else
		{
			alert("Please enter an email address." );
			return false;
		}

		
		/*
		 if( thegeo1 > 0 ) {
 			// return true;
 			count++;
		}
		else
		{
			alert("Please enter country." + thegeo1);
			return false;
		}		
		
		
		if( thegeo2 > 0 ) {
 			// return true;
 			count++;
		}
		else
		{
			alert("Please enter region." + thegeo2  );
			return false;
		}			
			
		
		if( thesec > 0 ) {
 			// return true;
 			count++;
		}
		else
		{
			alert("Please enter theme." + thesec );
			return false;
		}				

		
		if(count == 4){
	 		return true;
		}
		*/
	}
 }