/********************* PROMO NEWS HTTP SEARCH FUNCTIONS *********************
 *
 * Version 1.0
 *
 ****************************************************************************/

function promonews_importcss()
{
    var szLocationWithFilename = window.location.href;
    var iLastSlash = szLocationWithFilename.lastIndexOf('/');

    if(iLastSlash != -1)
    {
        szLocation = szLocationWithFilename.substr(0, (iLastSlash+1));

        if(document.createStyleSheet) {

        document.createStyleSheet(szLocation + PROMO_NEWS_CSS);

        }

        else {

        var styles = '@import url("' + szLocation + PROMO_NEWS_CSS + '");';

        var newSS=document.createElement('link');

        newSS.rel='stylesheet';

        newSS.href='data:text/css,'+escape(styles);

        document.getElementsByTagName("head")[0].appendChild(newSS);

        }
    }
}

function promonews_statuserror(xszErrorNo, xszErrorMsg)
{
    alert('Error getting data: [' + xszErrorNo + '] - ' + xszErrorMsg);
}

function promonews_updateprogress(xszProgress)
{
    var oElement = document.getElementById("progress");

    if(oElement)
    {
        oElement.innerHTML = xszProgress;
    }
}


function promonews_cleardiv(xszCSSID)
{
    var oElement = document.getElementById(xszCSSID);

    if(oElement)
    {
        oElement.innerHTML = "";
    }
}

function promonews_viewimage(imagepath, productname,myname,w,h,scroll)
{
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=yes';
  var url = 'viewimage.php?imagepath=' + imagepath;
      url += '&productname=' + productname;

  var win=window.open(url,myname,settings);
  if(parseInt(navigator.appVersion) >= 4)
  {
    win.window.focus();
  }
}
