﻿// This function resizes an IFrame object
// to fit its content.
// The IFrame tag must have a unique ID attribute.
function resizeIframeToFitContent(iframe) {
    var browser = navigator.appName;
    if (browser == "Microsoft Internet Explorer")
        iframe.height = document.frames[iframe.id].document.body.scrollHeight;
    else
        iframe.height = iframe.contentDocument.body.scrollHeight;
}


//This function finds the objects position
 function findPos(obj) {     
     var curleft = curtop = 0;
     if (obj.offsetParent) {
         do {
             curleft += obj.offsetLeft;
             curtop += obj.offsetTop;
         } while (obj = obj.offsetParent);
         //alert(curleft + ':' + curtop);
         return [curleft, curtop];
         
     }
 }

 //Function to collapse or expand an announcement section
 function ExpandOrCollpase(d) {
     if (d.id.indexOf('titleExpCol_') > -1) {
         d = document.getElementById(d.id.replace("titleExpCol", "imgExpCol"));
     }
     
     var divtoProcess = document.getElementById(d.id.replace("imgExpCol","divExpCol"));

     if (d.src.indexOf('AnnouncementExpanded') > -1) {
         d.src = d.src.replace('AnnouncementExpanded', 'AnnouncementCollapsed');
         divtoProcess.style.display = 'None';
     }
     else if (d.src.indexOf('AnnouncementCollapsed') > -1) {
         d.src = d.src.replace('AnnouncementCollapsed', 'AnnouncementExpanded');
         divtoProcess.style.display = 'Block';
     }
     //alert(d.id);
    
 }
