

<!--//
function open_Custom_Window(page,Dims) {
	OpenWin = this.open(page, "new",Dims )
}
//-->

<!---- === Confirm Delete Link === ----->
function del_Record(delthis) {
if(confirm("Do you really want to delete this record"))
window.location=delthis;
}

function del_Newsletter(delthis) {
if(confirm("Do you really want to delete this newsletter and associated items?"))
window.location=delthis;
}

function mouseover(col)
 {col.style.background = "White"
 col.style.color= "White"; }
function mouseout(col)
 { col.style.background = "#e5e5e5"; // This color value should match to DropDownTableBGColor value
   col.style.color= "White";  }


function newsOver(col)
 {col.style.background = "#e5e5e5"
 col.style.color= "White"; }
function newsOut(col)
 { col.style.background = "#FFFFFF"; // This color value should match to DropDownTableBGColor value
   col.style.color= "White"; }



function streamOver(col)
 {col.style.background = "#e5e5e5"
 col.style.color= "White"; }
function streamOut(col)
 { col.style.background = "#FFFFFF"; // This color value should match to DropDownTableBGColor value
   col.style.color= "White"; }


function Start(page,features) {
	OpenWin = this.open(page, "new", features);
}




function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function checkSupport(){

   var ValidChars = "0123456789";

	var emailID=document.supportForm.EmailAddress

	if (document.supportForm.CustomerName.value == "" ) {
		alert("Please add a Customer Name");
		document.supportForm.CustomerName.focus();
		return false;
	}


	if (document.supportForm.CompanyName.value == "" ) {
		alert("Please add a Company Name");
		document.supportForm.CompanyName.focus();
		return false;
	}


   	if (document.supportForm.TelephoneNumber.value == 0) {
      		alert("Please enter a telephone number.");
      		document.supportForm.TelephoneNumber.focus();
      		return false;
      	} else if (IsNumeric(document.supportForm.TelephoneNumber.value) == false) {
      		alert("Please enter a correct telephone number\nNumbers Only!");
      		document.supportForm.TelephoneNumber.value=="";      		
      		document.supportForm.TelephoneNumber.focus();
      		return false;
      	}


	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address")
		emailID.focus()
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false;
	}


	if ( document.supportForm.StreamingType.selectedIndex == 0 ) {
		alert("Please choose a Streaming Type");
		document.supportForm.StreamingType.focus();
		return false;
	}


	if (document.supportForm.Problem.value == "" ) {
		alert("Please add your problem");
		document.supportForm.Problem.focus();
		return false;
	}



	if (document.supportForm.EndUser.value == "" ) {
		alert("Please your End User message");
		document.supportForm.EndUser.focus();
		return false;
	}



		return true;


}



function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}
	


function checkContact(){

	var emailID=document.contactForm.Email

	if (document.contactForm.CompanyName.value == "" ) {
		alert("Please add a Company Name");
		document.contactForm.CompanyName.focus();
		return false;
	}


	if (document.contactForm.ContactName.value == "" ) {
		alert("Please add a Contact Name");
		document.contactForm.ContactName.focus();
		return false;
	}


   	if (document.contactForm.Telephone.value == 0) {
      		alert("Please enter a telephone number.");
      		document.contactForm.Telephone.focus();
      		return false;
      	} else if (IsNumeric(document.contactForm.Telephone.value) == false) {
      		alert("Please enter a correct telephone number\nNumbers Only!");
      		document.contactForm.Telephone.focus();
      		return false;
      	}


	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email Address")
		emailID.focus()
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false;
	}


	if (document.contactForm.Message.value == "" ) {
		alert("Please your Message");
		document.contactForm.Message.focus();
		return false;
	}


	if (document.contactForm.ImageField.value == "" ){
		alert("Please add the number code")
		document.contactForm.ImageField.focus();
		return false
	}






		return true;


}	



function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}



function calByListner(formName) {

		var formName= formName; // form name
		var cl = formName.cl.value; // Entered Number
		var bitrate = formName.bitrate.value; // Entered Number
		

	if (cl == "" ) {
		alert("Please enter Concurrent Listeners");
		formName.cl.focus();
		return false
	}
		
	if (bitrate == "" ) {
		alert("Please add bitrate");
		formName.bitrate.focus();
		return false
	}	
		
		

		
	   var ValidChars = "0123456789.";
	   var IsNumber=true;
	   var Char;

 
	   for (i = 0; i < cl.length && IsNumber == true; i++) 
	      { 
	      Char = cl.charAt(i); 
	      if (ValidChars.indexOf(Char) == -1) 
		 {
		 alert('Please enter numbers only');
		 return false;
		 }
	      }


	   for (i = 0; i < bitrate.length && IsNumber == true; i++) 
	      { 
	      Char = bitrate.charAt(i); 
	      if (ValidChars.indexOf(Char) == -1) 
		 {
		 alert('Please enter numbers only');
		 return false;
		 }
	      }		
		
		

		var bandwidth=(cl*bitrate)/1000
		formName.bandwidth.value=bandwidth; 
		
		var baseprice=bandwidth*50;
		
		if (baseprice-((baseprice/100)*10)> formName.minprice.value) {

			formName.baseprice.value=CurrencyFormatted(baseprice);
		}else{
			formName.baseprice.value=99.00;
			baseprice=99;

		}
		
		
		
		formName.weeklyprice.value=CurrencyFormatted(baseprice/2);	
		formName.dailyprice.value=CurrencyFormatted((baseprice/2)/3);	
 
		
		
		var costpermb=formName.costpermb.value;
		
		var calculateddiscount=(bandwidth /formName.totalbandwidth.value)*100;
		formName.calculateddiscount.value=calculateddiscount; 
	
	
	if (calculateddiscount.toFixed(2) > (formName.maxdiscount.value*1)) {			//If discount is > then Max

		formName.discount.value=75;
		formName.price.value=baseprice-((baseprice/100)*75);
		
	} else {

		if (calculateddiscount.toFixed(2) < (formName.mindiscount.value*1)) {	//If discount is < than Min

	
			if (baseprice-((baseprice/100)*10)> formName.minprice.value) {


				//alert(baseprice)

				//formName.price.value=CurrencyFormatted(baseprice-((baseprice/100)*10));
				
				if (baseprice<300){
					formName.price.value=CurrencyFormatted(baseprice);
					formName.discount.value=0;				
				}else{
					formName.price.value=CurrencyFormatted(baseprice-((baseprice/100)*10));
					formName.discount.value=10;
				}
				
				
			}else{
				formName.price.value=99;
				formName.discount.value=0;	
			}



		} else {																			//If discount is > Min
			formName.discount.value=calculateddiscount.toFixed(2);
			formName.price.value=CurrencyFormatted(baseprice-((baseprice/100)*calculateddiscount.toFixed(2)));
			
			
		}
	}
	
	

	
}