
function jscss(a,o,c1,c2)
{
  switch (a){
    case 'swap':
      o.className=!jscss('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
    break;
    case 'add':
      if(!jscss('check',o,c1)){o.className+=o.className?' '+c1:c1;}
    break;
    case 'remove':
      var rep=o.className.match(' '+c1)?' '+c1:c1;
      o.className=o.className.replace(rep,'');
    break;
    case 'check':
      return new RegExp('\\b'+c1+'\\b').test(o.className)
    break;
  }
}
/*
This example function takes four parameters:

a 
defines the action you want the function to perform. 
o 
the object in question. 
c1 
the name of the first class 
c2 
the name of the second class 
Possible actions are:

swap 
replaces class c1 with class c2 in object o. 
add 
adds class c1 to the object o. 
remove 
removes class c1 from the object o. 
check 
test if class c1 is already applied to object o and returns true or false. 

*/

function ShowPartner(index, coll) {
    for(i=0;i<coll.length;++i) {
        var item = coll[i];
        if (i == index) {
            jscss('remove',item,'hidden');
        }
        else {
            jscss('add',item,'hidden');
        }
    }
}

function ShowNextPartner (index, coll) {
    if (index<0) {
        index = Math.floor((Math.random()*coll.length)%coll.length);
    }
    ShowPartner(index, coll);
    setTimeout('ShowNextPartner('+((index+1)%coll.length)+',collection)', 5000);
}

function ShowNextAdvert (index, coll) {
    if (index<0) {
        index = Math.floor((Math.random()*coll.length)%coll.length);
    }
    ShowPartner(index, coll);
    setTimeout('ShowNextAdvert('+((index+1)%coll.length)+',collectionadv)', 5000);
}

//document.domain = "acteonline.org";
$(function () {
	$('#ISGwebContainer').attr('height','710');
    /*var $iframe = $('#ISGwebContainer'),
      iframe = $iframe[0];
    $iframe.load(function () {
        console.log('test');
        console.log(iframe.contentWindow.document.body.offsetHeight);
        iframe.style.height = (iframe.contentWindow.document.body.offsetHeight + 30) + 'px';
    });*/
});

//function iFrameAutoHeights() {
//    var iFrames = document.getElementsByTagName('iframe');
//    for (var x = 0; x < iFrames.length; x++) {
//        console.log(x);
//        if (iFrames[x].addEventListener) iFrames[x].addEventListener("load", function () { console.log('loaded'); }, true);
//        else if (iFrames[x].attachEvent) iFrames[x].attachEvent("onload", function () { iFrameAutoHeight(iFrames[x]); });
//    }
//}

//function iFrameAutoHeight(iframe) {
//    console.log(iframe.contentWindow.document.body.offsetHeight);
//    iframe.style.height = (iframe.contentWindow.document.body.offsetHeight + 30) + 'px';
//}

//if (window.addEventListener) window.addEventListener("load", iFrameAutoHeights, false);
//else if (window.attachEvent) window.attachEvent("onload", iFrameAutoHeights);

