﻿addLoadEvent(chkForParent)
function chkForParent(){
if (window.parent.setframe)
//    createFormAndSubmit()
//    else
    window.parent.Show()
    }
function getNewSubmitForm(){
 var submitForm = document.createElement("FORM");
 document.body.appendChild(submitForm);
 submitForm.method = "POST";
 return submitForm;
}
function createNewFormElement(inputForm, elementName, elementValue){
 var newElement = document.createElement('input');
 newElement.setAttribute('name','page');
 newElement.setAttribute('type','hidden');
 inputForm.appendChild(newElement);
 newElement.value = elementValue;
 return newElement;
}
function createFormAndSubmit(){
 var submitForm = getNewSubmitForm();
 createNewFormElement(submitForm, "page", window.document.location);
 submitForm.action= "default.aspx";
 submitForm.submit();
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
    window.onload = func;
    } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
