function getURLParam(){
  var strReturn = "";
  var strHref = window.location.href;
  var pos1 = strHref.indexOf("?");
  if (pos1 > -1) {
    var pos2 = strHref.indexOf("&"); 
    if (pos2 > -1) {
      var aQueryString = strHref.split("&");
      strReturn = aQueryString[0];
    } else {
      strReturn = strHref;
    }
  } else {
    strReturn = strHref;
  }
  return strReturn;
}

function createDiv() {
  var divTag = document.createElement("div");
  divTag.id = "datadiv";
  //divTag.style.left = "0px";
  //divTag.style.top = "0px";
  //divTag.style.position = "absolute";
  //divTag.style.visibility ="hidden";
  document.body.appendChild(divTag);
  return divTag;
}

function createIframe (iframeName, width, height) {
  var iframe;
  if (document.createElement && (iframe = document.createElement('iframe'))) {
    iframe.name = iframe.id = iframeName;
    iframe.width = width;
    iframe.height = height;
    iframe.style.border = "0px";
    iframe.scrolling = "no";
    iframe.setAttribute("frameBorder", "0");

    /*iframe.src = '/test1/index.php?id=345&rnd=KJGHkjsdhf';*/
    iframe.src = 'http://www.iloveyourblog.com/ratingwidget/index.php?url='+getURLParam();
    //document.body.appendChild(iframe);
    document.getElementById("ilybframepos").appendChild(iframe);
  }
  return iframe;
}

function includeCSS(p_file) {
	var v_css  = document.createElement('link');
	v_css.rel = 'stylesheet'
	v_css.type = 'text/css';
	v_css.href = p_file;
	document.getElementsByTagName('head')[0].appendChild(v_css);
}

function includeCSSinframe(p_file) {
	var v_css  = document.createElement('link');
	v_css.rel = 'stylesheet'
	v_css.type = 'text/css';
	v_css.href = p_file;
	document.getElementById("dataframe").contentWindow.document.getElementsByTagName('head')[0].appendChild(v_css);
}

function includeJS(filename) {
  var head = document.getElementsByTagName('head')[0];
  script = document.createElement('script');
  script.src = filename;
  script.type = 'text/javascript';
  head.appendChild(script)
}

function includeJSinframe(filename) {
  var head = document.getElementById("dataframe").contentWindow.document.getElementsByTagName('head')[0];
  script = document.getElementById("dataframe").contentWindow.document.createElement('script');
  script.src = filename;
  script.type = 'text/javascript';
  head.appendChild(script)
}

function begin() {
  var iframe = createIframe ('dataframe', 210, 100);
}

//var div = createDiv();

document.write("<div id='ilybframepos'></div>");

//window.onload = function (evt) {
  begin();
//}
