﻿/* Frontpage banners */
function TjekTal(TalString, strNums) { 
	  var strNumbers = new String(strNums);
        if(TalString.length == 0) {  
                return false;  
        }  
        for (var nIndex=0; nIndex < TalString.length; nIndex++) {  
                if (strNumbers.indexOf(TalString.charAt(nIndex)) == -1) {  
                        return false;  
                }  
        }  
        return (true);  
	  }
	
	  


/* Subpage banners*/

    var ImgSubBannerArr = new Array()
    var strRandom = new String();

    function RandomSubBanner(){
	    var ImgSubArr = new Array();
	    var IntA = 1;
	    strRandom = 0;
	
	    ImgSubArr[1] = '<img src="/files/system/images/sidebannere/1.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[2] = '<img src="/files/system/images/sidebannere/2.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[3] = '<img src="/files/system/images/sidebannere/3.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[4] = '<img src="/files/system/images/sidebannere/4.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[5] = '<img src="/files/system/images/sidebannere/5.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[6] = '<img src="/files/system/images/sidebannere/6.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[7] = '<img src="/files/system/images/sidebannere/7.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[8] = '<img src="/files/system/images/sidebannere/8.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[9] = '<img src="/files/system/images/sidebannere/9.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[10] = '<img src="/files/system/images/sidebannere/10.jpg" width="158" height="142" border="0"  alt="" />';
	    ImgSubArr[11] = '<img src="/files/system/images/sidebannere/11.jpg" width="158" height="142" border="0"  alt="" />';

    	
    	for(IntA=1;IntA<=2;IntA++){
		    var RndNum=Math.floor(Math.random()*ImgSubArr.length);
		    
		    if(RndNum!=0 && !TjekTal(String(RndNum),String(strRandom))){
			    ImgSubBannerArr[IntA] = ImgSubArr[RndNum];
			    strRandom = String(strRandom + RndNum);
			    }
		    else{IntA--;}
	}
}
