

var partnerKey = "YJ08816";
var showSponsoredLinks = false;
var mode = "Embedded";

window.onload = function()
{      
    var width = 850;
    var height = 980;
    
    if (mode == "Embedded")
    {
        createInlineFrame("http://www.techselector.com/partners/network/Controller.aspx?e=1&id=" + partnerKey, width, height);
        //setTimeout("checkUpdateAds()", 3000);
    }
    else
    {
        dhtmlLoadCss("http://www.techselector.com/Css/style.css");
        dhtmlLoadCss("http://www.techselector.com/Css/style_additions.css");
        dhtmlLoadCss("http://www.techselector.com/Css/subModal.css");
    
        dhtmlLoadScript("http://www.techselector.com/Scripts/xmlhttp.js", -1);
        dhtmlLoadScript("http://www.techselector.com/Scripts/modal/common.js", -1);
        dhtmlLoadScript("http://www.techselector.com/Scripts/jquery-1.2.js", -1);
        dhtmlLoadScript("http://www.techselector.com/Scripts/ian.js", -1);
        dhtmlLoadScript("http://www.techselector.com/Scripts/dwrutil.js", -1);
        dhtmlLoadScript("http://www.techselector.com/Scripts/jquery.dimensions.js", -1);
        dhtmlLoadScript("http://www.techselector.com/Scripts/modal/subModal.js", -1);
        dhtmlLoadScript("http://www.techselector.com/ajax/common.ashx", -1);
        dhtmlLoadScript("http://www.techselector.com/ajax/partners_network_Controller,App_Web_qvisuiiz.ashx", -1);
        dhtmlLoadScript("http://www.techselector.com/ajax/partners_network_Questionnaire,App_Web_qvisuiiz.ashx", -1);

        //if (navigator.appName == "Microsoft Internet Explorer") setTimeout("LoadPopup()", 3000);
        LoadPopup();
    }
}

var ianPageState = "";
function checkUpdateAds()
{   
    if (window.frames['RSIFrame'].document.getElementById("ian_page_state").value != ianPageState)
    {
        eval("updateAds()");
        ianPageState = window.frames['RSIFrame'].document.getElementById("ian_page_state").value;
    }
        
    setTimeout("checkUpdateAds()", 3000);    
}

function dhtmlLoadCss(url)
{
    var headID = document.getElementsByTagName("head")[0];         
    var cssNode = document.createElement('link');
    cssNode.type = 'text/css';
    cssNode.rel = 'stylesheet';
    cssNode.href = url;
    cssNode.media = 'screen';
    headID.appendChild(cssNode);
}

function dhtmlLoadScript(url, state)
{
   var e = document.createElement("script");
   e.src = url;
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e);
}

function hidePopup()
{
    hidePopWin(false);
}

function LoadPopup()
{
    var html = '<p class="body_text_2"><a href="javascript:void(0)" onclick="initPopUp(); showPopWin(\'http://www.techselector.com/partners/network/Controller.aspx?e=1&id=YJ08816\', 850, 980, \'\', null);"><img src="http://www.techselector.com/partners/icons/mag_sml.gif" border="0" /></a></p>';
    html += '<div id="popupMask">&nbsp;</div>';
    html += '<div id="popupContainer" style="display: none">';
    html += '    <div id="popupInner">';
    html += '        <div id="popupTitleBar">';
    html += '            <div id="popupTitle" class="comments_title">';
    html += '            </div>';
    html += '            <div id="popupControls" style="padding-right: 60px"><a href="javascript:hidePopWin(false)"><img src="http://www.techselector.com/images/ian/exit.gif" border="0"/></a>';
    //html += '            <div id="popupControls">';
    html += '            </div>';
    html += '        </div>';
    html += '        <div id="popupContentArea" style="background-color: transparent; border: 0">';
    html += '        </div>';
    html += '    </div>';
    html += '</div>';
    document.getElementById("tech_selector").innerHTML = html;
}

var IFrameObj; // our IFrame object
var IFrameDoc;
function createInlineFrame(URL, width, height) 
{
  if (!document.createElement) {return true};
  if (!IFrameObj && document.createElement) {
   try 
   {
      var tempIFrame=document.createElement('iframe');
      tempIFrame.setAttribute('id','RSIFrame');
      tempIFrame.setAttribute('name','RSIFrame');
      tempIFrame.setAttribute('frameborder','0');
      tempIFrame.style.border='0px';
      tempIFrame.style.width=width + 'px';
      tempIFrame.style.height=height + 'px';
      IFrameObj = document.getElementById('tech_selector').appendChild(tempIFrame);
      
      if (document.frames) 
      {
        IFrameObj = document.frames['RSIFrame'];
      }
    } 
    catch(exception) 
    {
      iframeHTML='\<iframe id="RSIFrame" name="RSIFrame" frameborder="0" style="';
      iframeHTML+='border:0px;';
      iframeHTML+='width:" + width + "px;';
      iframeHTML+='height:" + height + "px;';
      iframeHTML+='"><\/iframe>';
      //document.body.innerHTML+=iframeHTML;
      document.getElementById('tech_selector').innerHTML = iframeHTML;
      IFrameObj = new Object();
      IFrameObj.document = new Object();
      IFrameObj.document.location = new Object();
      IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
      IFrameObj.document.location.replace = function(location) {
        this.iframe.src = location;
      }
    }
  }
  
  if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument) 
  {
    setTimeout("createInlineFrame('" + URL + "')",10);
    return false;
  }
  
  if (IFrameObj.contentDocument) 
  {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument; 
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }
  
  IFrameDoc.location.replace(URL);
  return false;
}
