/* (c) by RiS GmbH - 2002 */

function FrameFehler(src, reload)
{
// alert("framefehler: " + src + " url: " + document.location.href);
// return;
 if(reload == false)
  self.location.href += (((self.location.href.search(/\?/) > 0)?'&':'?') + 'framegestohlen=1&pruefer=' + ((src=='pf')?'ParentFrame':'FrameCounter'));
 else
  top.location.href = sPage2Load
}

function checkParentFrames(lVorgaenger, sTeilURL){return checkFrameParent(self.parent, sTeilURL, lVorgaenger - 1);}

function checkFrameStrukt()
{
 var URLcount = 0;
 var fehler = true;
 while(URLcount < vFrameNr.length / 2 && fehler)
 {
  if(self.location.href.search(vFrameNr[URLcount*2]) >= 0)
  {
   if(checkFrameLength(top, vFrameNr[URLcount*2+1])) fehler = true;
   else fehler = false;
  }
  URLcount++;
 }
 return fehler;
}

function checkFrameParent(vFrame, sCmp, lParents)
{
 var count = 0;
 var sUrl = getHREF(vFrame);
//alert(sUrl);
 if(!sUrl.length > 0 || !(sUrl.search(sCmp) >= 0))  return true;
 if(!(lParents>0)) { return false; } lParents--;	
 if(vFrame.parent != vFrame)
  return checkFrameParent(vFrame.parent, sCmp, lParents);
 else
  return true;    
 return false; 	
}

var lStart = 0;
function checkFrameLength(vFrame, vFrames)
{
 var bCheckSum = false;
 if(lStart == 0) bCheckSum = true;
 if(vFrames.length <= lStart) return true;
// alert('IST: '  + vFrame.frames.length + ' - SOLL: ' + vFrames[lStart] + ' - Nr: ' + (lStart+1) + ' - ' + vFrame.name + ' - ' + vFrame.location.href);
 if(vFrame.frames.length != vFrames[lStart])
 {
  if(aldbgmsg) alert('IST: '  + vFrame.frames.length + ' - SOLL: ' + vFrames[lStart] + ' - Nr: ' + (lStart+1) + ' ' + vFrame.location.href);
  return true;
 }
 var count = 0;
 while(vFrame.frames.length > count)
 {
  lStart++;
  if(checkFrameLength(vFrame.frames[count], vFrames)) return true;
  count++;
 }
 if(bCheckSum && (lStart + 1) != vFrames.length)
 {
  alert(lStart + ' - ' + vFrames.length);
 	 return true;
 }
 return false;
} 

function getHREF(vFrame){var sUrl = '';try{sUrl = vFrame.location.href;}catch(err){sUrl=''}return sUrl;}
