// JavaScript to interpolate random images into a page.
 
 var rethm = new String("The Rethm Saadhana uses the legendary Lowther DX55 as its main driver, handling the frequencies from 75hz through to 20khz. The DX55 is probably the fastest driver in the world, so combining it with a bass module that could keep up involved using a driver of the same paper cone material and sealing it in an isobaric/horn laoded system. A passive crossover is employed to help ensure the two drivers blend seamlessly together. The result is a speaker which extends the coherence of the single DX55 driver down to a solid 32hz without any discontinuities as musical sounds ascend and descend through these ranges. The bass module is actually the rear section of the speaker as pictured here. Between the two modules is a cover which is lifted off to reveal the crossover and bass level controls. These provide the ability to fine tune the speaker to suit your listening room and taste. The Saadhana comes in four different attractive contempory finishes, listed below.");
 
 	var rethmFR = new String("The Rethm Saadhana uses the legendary Lowther DX55 as its main driver, handling the frequencies from 75hz through to 20khz. The DX55 is probably the fastest driver in the world, so combining it with a bass module that could keep up involved using a driver of the same paper cone material and sealing it in an isobaric/horn laoded system. A passive crossover is employed to help ensure the two drivers blend seamlessly together. The result is a speaker which extends the coherence of the single DX55 driver down to a solid 32hz without any discontinuities as musical sounds ascend and descend through these ranges. The bass module is actually the rear section of the speaker as pictured here. Between the two modules is a cover which is lifted off to reveal the crossover and bass level controls. These provide the ability to fine tune the speaker to suit your listening room and taste. The Saadhana comes in four different attractive contempory finishes, listed below. To be translated");
		
		var harmonic = new String("");
		
		var redwine = new String("'Giant Killer' this is how Srajan Ebean, the editor of 6Moons <a href='http://www.6moons.com/audioreviews/redwine8/302.html'>described the new Red Wine Audio Signature 30.2</a> amplifier. By combining digital amplifier technology with battery power, to completely isolate the amplifier from the mains, the Signature 30.2 achieves similar delicate purity of sound to some of the finest and most expensive Single Ended Triode tube amplifers available and manages to achieve it at a fraction of their cost. It's 30 watts per channel and high current delivery allow it to convey all the excitement and swing on high energy complex music as well. When combined with our high efficiency speakers it has plenty of headroom to spare. It provides an ideal match with the <a href='saadhana.html'>Rethm Saadhana's</a> as discovered by Srajan as well as Podium, Zu and our other speakers. It is available as an integrated amplifier complete with remote volume control or as a stand alone power amplifier for customers who wish to use it with a separate pre-amplifier, such as Red Wine Audio's soon to be available Isabella tube pre-amplifier.");
		
		var redwineFR = new String("'Giant Killer' this is how Srajan Ebean, the editor of 6Moons <a href='http://www.6moons.com/audioreviews/redwine8/302.html'>described the new Red Wine Audio Signature 30.2</a> amplifier. By combining digital amplifier technology with battery power, to completely isolate the amplifier from the mains, the Signature 30.2 achieves similar delicate purity of sound to some of the finest and most expensive Single Ended Triode tube amplifers available and manages to achieve it at a fraction of their cost. It's 30 watts per channel and high current delivery allow it to convey all the excitement and swing on high energy complex music as well. When combined with our high efficiency speakers it has plenty of headroom to spare. It provides an ideal match with the <a href='saadhana.html'>Rethm Saadhana's</a> as discovered by Srajan as well as Podium, Zu and our other speakers. It is available as an integrated amplifier complete with remote volume control or as a stand alone power amplifier for customers who wish to use it with a separate pre-amplifier, such as Red Wine Audio's soon to be available Isabella tube pre-amplifier. To be translated");
		
		var ancient = new String("");
		
		var ear = new String("");
		
		var omega = new String("");
		
	var opera = new String("");
		
		var podium = new String("");
		
		var podiumFR = new String("");
		
		var tead = new String("");
		
	var fortysevenlabs = new String("");
		
	var Goldenote = new String("");
		
		var zu = new String("");
		
		
	var fujitsu = new String("");
	
	var fujitsuFR = new String("");
		
	var companyChoice = 0;
	
	var language = "";

     function pickRandom(range) {
        if (Math.random)
            return Math.round(Math.random() * (range-1));
        else {
            var now = new Date();
            return (now.getTime() / 1000) % range;
        }
    }
	
	function picklang(choice) {
        language = choice;
		//alert(companyChoice);
		setCookie('language',choice,365);
		loadMainImage(companyChoice);
    }

    
    function loadMainImage(optional) {
    	MM_preloadImages('admin/images/navigation/home_hover.jpg', 'admin/images/navigation/about_hover.png','admin/images/navigation/products_hover.png','admin/images/navigation/companies_hover.png','admin/images/navigation/contact_hover.png', 'admin/images/navigation/home_active.jpg', 'admin/images/navigation/about_active.png','admin/images/navigation/products_active.png','admin/images/navigation/companies_active.png','admin/images/navigation/contact_active.png');
		
   		var ic = 5;                     // Number of alternative images
   		var i = new Array(ic);          // Array to hold imagenames
		i[0] = "admin/images/fujitsu-ten1.jpg";
		i[1] = "admin/images/omega1.jpg";
		i[2] = "admin/images/podium1.jpg";
		i[3] = "admin/images/rethm1.jpg";
   		i[4] = "admin/images/zu1.jpg";
		
		
   		
		
		
		var h = new Array(ic);          // Array to hold company header names
		h[0] = "Fujitsu-Ten Eclipse";
		h[1] = "Omega Speaker Systems";
		h[2] = "Podium Sound";
		h[3] = "Rethm";
   		h[4] = "Zu";
		
   		
	
		
		
		var c = new Array(12);          // Array to hold company blurbs
		c[0] = fujitsu;
		c[1] = omega;
		c[2] = podium;
		c[3] = rethm;
   		c[4] = zu;
		c[5] = redwine;
		c[6] = fujitsuFR;
		c[7] = omega + " french";
		c[8] = podiumFR;
		c[9] = rethmFR;
   		c[10] = zu + " french";
		c[11] = redwineFR;
		
		
   			
   		if ( optional === undefined ) {	
   			var ic = 3;
			companyChoice = ic;
		}else{
			var ic = optional;
			companyChoice = ic;
		}
		
		//alert(optional);
	
   		var choice = i[ic];
		
    	
		language = getCookie('language');
		//alert(language);
		if (language=='french'){
			choice = c[ic+6];
		}else{
			choice = c[ic];
		}
		var maintext = new Array(100);
		var anAnchor = new Array(4);
		maintext = stringSegment(choice, '\n');
		var contentPara = document.getElementById('PprodText');
		while(contentPara.childNodes.length > 0){	
			contentPara.removeChild(contentPara.childNodes[0]);
		}
		var anchorCount = 0;
		for(i=0;i<maintext.length;i++){
			//process this para within maintext
			anAnchor = findAnchor(maintext[i],0);
			if(anAnchor[0]==-1){
				var content = document.createTextNode(maintext[i]);
				contentPara.appendChild(content);
				contentPara.appendChild(document.createElement('br'));
				contentPara.appendChild(document.createElement('br'));
			}else{
				while(anAnchor[0]!=-1){
					var preAnchor = maintext[i].substring(anchorCount,anAnchor[0]);
					var content = document.createTextNode(preAnchor);
					contentPara.appendChild(content);
					var theAnchor = document.createElement("a");
					theAnchor.setAttribute('href', anAnchor[2]);
					theAnchor.appendChild(document.createTextNode(anAnchor[3]));
					contentPara.appendChild(theAnchor);
					anchorCount = anAnchor[1];
					//alert(anchorCount);
					anAnchor = findAnchor(maintext[i],anchorCount);
				}
				var postAnchor = maintext[i].substring(anchorCount);
				content = document.createTextNode(postAnchor);
				contentPara.appendChild(content);
				contentPara.appendChild(document.createElement('br'));
				contentPara.appendChild(document.createElement('br'));
			}
		anchorCount = 0;
		}
		
   	}
	
   	
	
	
	
	
   	
   	function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	function MM_swapImgRestore() { //v3.0
  	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}

function findAnchor(theString,theIndex){
	var temp = new Array(4);
	var start = theString.indexOf('<a href',theIndex);
	var linkEnd = theString.indexOf('>',theIndex);
	var anchorEnd = theString.indexOf('</a>',theIndex);
	temp[0]=start;
	temp[1]=anchorEnd+4;
	temp[2] = theString.substring(start+9,linkEnd-1);
	temp[3] = theString.substring(linkEnd+1,anchorEnd);
	return temp;
}


function stringSegment(theString,theChar){ 
			var temp = new Array();
			temp = theString.split('\n');
			
	return temp;
}



