var oCurrentSrc=null;
var mainurl="http://post.bioneer.co.kr/~com/new_ushome";

 function sizePage(){
//	window.moveTo(0,0);
//	resizeTo(800, screen.availHeight);
	document.getElementById("oContents").style.height=document.body.clientHeight-parseInt(document.getElementById("oPageBottom").clientHeight) - parseInt(document.getElementById("oContents").style.top)-5;
	document.getElementById("oNewsItems").style.height=document.body.clientHeight-parseInt(document.getElementById("oPageBottom").clientHeight) - parseInt(document.getElementById("oNewsItems").style.top)-5;
	document.getElementById("oLeftMenu").style.height=document.body.clientHeight-parseInt(document.getElementById("oPageBottom").clientHeight) - parseInt(document.getElementById("oLeftMenu").style.top)-5;
	document.getElementById("oContents").style.width=document.body.clientWidth-2-parseInt(document.getElementById("oContents").style.left);

	
//	var myframe = document.getElementById("oAccountDetail");
//	alert(myframe.height);
//	myframe.height=document.body.clientHeight-76;
//	var myContentframe = document.getElementById("oPageDetail");
//	myContentframe.height=document.body.clientHeight-94;
//    myContentframe.width=document.body.clientWidth-42;
//	alert(window.height=window.screen.height);
//	alert(document.body.clientHeight);
//	alert(screen.availHeight);
//	alert(screen.availWidth);
//	window.Height=screen.availHeight;
}

/*---------- Random Image ---------------- */
 function random_image()
 {
  var mainimages = new Array();

  // Ãâ·ÂÇÒ ÀÌ¹ÌÁö
  mainimages[0] = "<a href='"+mainurl+"/products/siRNA_Home.php' title='Click to find out more'>";
  mainimages[0] = mainimages[0]+"<img src='"+mainurl+"/images/main/main_siRNA.jpg' alt='Introducing AccuPrep Nano-Plus DNA Extraction Kits: ";
  mainimages[0] = mainimages[0]+"Get 20% OFF on your first Purchase' width='405' height='368' border='0' usemap='#Map'><map name='Map'>";
  mainimages[0] = mainimages[0]+"<area shape='rect' coords='0,1,401,257' href='"+mainurl+"/products/siRNA_Home.php'>";
  mainimages[0] = mainimages[0]+"<area shape='rect' coords='4,265,406,370' href='"+mainurl+"/products/AccuPower_CycleScript_RT_PreMix.php'></map></a>";
  mainimages[1] = "<img src='"+mainurl+"/images/main/main_Exicycler.jpg' border='0'>";
 
  var ry = Math.floor( Math.random() * (myimages.length-1) );
  document.write(myimages[ry]);
 }



function sizeMenu() {
    if (navigator.appName.indexOf("Netscape") != -1) {
        var DivChild=document.getElementById("productListBox");
        for (var i=0; i<DivChild.childNodes.length;i++) {
            if (DivChild.childNodes[i].nodeName.toLowerCase() == "div") {
                DivChild.childNodes[i].style.width=99;
            }
        }
        
        var DivChild=document.getElementById("DNA_AmplificationListBox");
        for (var i=0; i<DivChild.childNodes.length;i++) {
            if (DivChild.childNodes[i].nodeName.toLowerCase() == "div") {
                DivChild.childNodes[i].style.width=124;
            }
        }
        
        var DivChild=document.getElementById("DNA_RNA_IsolationListBox");
        for (var i=0; i<DivChild.childNodes.length;i++) {
            if (DivChild.childNodes[i].nodeName.toLowerCase() == "div") {
                DivChild.childNodes[i].style.width=119;
            }
        }
        
        var DivChild=document.getElementById("Oglio_ListBox");
        for (var i=0; i<DivChild.childNodes.length;i++) {
            if (DivChild.childNodes[i].nodeName.toLowerCase() == "div") {
                DivChild.childNodes[i].style.width=89;
            }
        }
        
        var DivChild=document.getElementById("supportListBox");
        for (var i=0; i<DivChild.childNodes.length;i++) {
            if (DivChild.childNodes[i].nodeName.toLowerCase() == "div") {
                DivChild.childNodes[i].style.width=109;
            }
        }
        
        var DivChild=document.getElementById("company_InfoListBox");
        for (var i=0; i<DivChild.childNodes.length;i++) {
            if (DivChild.childNodes[i].nodeName.toLowerCase() == "div") {
                DivChild.childNodes[i].style.width=129;
            }
        }
        
        var DivChild=document.getElementById("coming_SoonListBox");
        for (var i=0; i<DivChild.childNodes.length;i++) {
            if (DivChild.childNodes[i].nodeName.toLowerCase() == "div") {
                DivChild.childNodes[i].style.width=109;
            }
        }
        
        var DivChild=document.getElementById("OligoCustom_ListBox");
        for (var i=0; i<DivChild.childNodes.length;i++) {
            if (DivChild.childNodes[i].nodeName.toLowerCase() == "div") {
                DivChild.childNodes[i].style.width=104;
            }
        }
    }
}    

function setCrumb(sBreadCrumb, HotMenu,sideMenu,newsItems) {
    //reset all images
    document.getElementById("About").src="images/menu_about.jpg";
    document.getElementById("Life").src="images/menu_life.jpg";
    document.getElementById("Molecular").src="images/menu_molecular.jpg";
    document.getElementById("support").src="images/menu_support.jpg";
    document.getElementById("catalog").src="images/menu_brochure.jpg";
    
    var ThisCrumb = document.getElementById("Breadcrumb");
    ThisCrumb.innerHTML=sBreadCrumb;
    if (sBreadCrumb > "") {
        document.getElementById("oContents").style.top=110;
    } else {
        document.getElementById("oContents").style.top=79;
    }
    if (HotMenu> "") {
        var ThisHot = document.getElementById(HotMenu);
        ThisHot.src = ThisHot.src.substring(0,ThisHot.src.length-4)+"_DOWN.jpg";
    }
    if (sideMenu >"") {
        document.getElementById("oLeftMenu").src=sideMenu;
        document.getElementById("oLeftMenu").style.display="block";
        document.getElementById("oContents").style.left=parseInt(document.getElementById("oLeftMenu").style.width)+parseInt(document.getElementById("oLeftMenu").style.left)+10;
    } else {
        document.getElementById("oLeftMenu").style.display="none";
        document.getElementById("oContents").style.left=17;
    }
    if (newsItems >"") {
        document.getElementById("oNewsItems").src='NewsItems.html';
        document.getElementById("oNewsItems").style.display="block";
    } else {
        document.getElementById("oNewsItems").src='NewsItems.html';
        document.getElementById("oNewsItems").style.display="none";
    }    
    CloseAll();
    sizePage();
}

function Load(sPage) {
    CloseAll();
    var DetailDiv = document.getElementById("oContents");
    switch(sPage) {
        case "Home":
            location.href = mainurl+"/index.php";
            break;
        case "Search":
            if (document.getElementById("Search").value.length>0) {
                DetailDiv.src=document.getElementById("Search").value;
            }
            break;
        case "ComingSoon":
            location.href = "Coming_Soon.html";
            break;
        case "Contact":
            location.href = mainurl+"/contact/Contact_Us.php";
            break;
        case "BusinessAreas":
            location.href = mainurl+"/about/About_Business_Areas.php";
            break;
        case "OurHistory":
            location.href =mainurl+"/about/About_History.php";
            break;
        case "OurMission":
            location.href = mainurl+"/about/About_Mission.php";
            break;
        case "OurPatents":
            location.href = mainurl+"/about/About_Patents.php";
            break;
        case "DNARNAPrep":
            location.href = mainurl+"/products/AccuPrep_Home.php";
            break;
        case "DNARNAAmp":
            location.href = mainurl+"/products/AccuPower_Home.php";
            break;
		case "DNAMarkers":
            location.href = mainurl+"/products/DNA_Markers_Home.php";
            break;	
		case "Instruments":
            location.href = mainurl+"/products/Instruments_Home.php";
            break;	
		case "CNT-MetalNano":
            location.href = mainurl+"/products/CNT_Home.php";
            break;
		case "DiagnosticKits":
            location.href = mainurl+"/products/Dianostic_Kit_Home.php";
            break;
		case "Exicycler":
            location.href = mainurl+"/products/Exicycler_Home.php";
            break;
		case "ProductChart":
            location.href = mainurl+"/products/Product_Chart.php";
            break;
		case "Phosphoramidites":
            location.href = mainurl+"/products/Phosphoramidites1_Home.php";
            break;
		case "Catalog":
            location.href = mainurl+"/products/Catalog.php";
            break;	
        case "AccuPowerSeries":
            location.href = mainurl+"/products/AccuPower_PreMix_Series.php";
            break;
        case "AccuPowerSelectionChart":
            location.href = mainurl+"/products/AccuPower_SelectionChart.php";
            break;
        case "Oligonucleotides":
            location.href = mainurl+"/products/Oligos_Home.php";
            break;
        case "OligoOrderForm":
            window.open("Bioneer_Oligo_Order_Form.xls",null,"height=500,width=500,status=yes,toolbar=no,menubar=yes,location=no");
            break;
        case "OligoStandard":
            location.href = mainurl+"/products/oligos_standard.php";
            break;
        case "OligoHighThroughput":
            location.href = mainurl+"/products/oligos_High_throughput.php";
            break;
        case "OligoModification":
            location.href = mainurl+"/products/oligos_modified.php";
            break;
        case "OligoBulk":
            location.href = mainurl+"/products/oligos_bulk.php";
            break;
        case "OligoGeneralInfo":
            location.href = mainurl+"/products/oligos_general_info.php";
            break;
        case "OligoQCQA":
            location.href = mainurl+"/products/oligos_quality_control.php";
            break;
        case "OligoFAQ":
            location.href = mainurl+"/products/oligos_faq.php";
            break;
        case "siRNA":
            location.href = mainurl+"/products/siRNA_Home.php";
            break;
        case "SupportSalesSupport":
            location.href = mainurl+"/support/Support_Sales_Support.php";
            break;
        case "SupportHowToPlaceAnOrder":
            location.href = mainurl+"/support/Support_HowToOrder.php";
            break;
        case "SupportProtocols":
            location.href = mainurl+"/support/Support_Protocols.php";
            break;
		case "ShippingInfo":
		location.href = mainurl+"/support/Support_Shipping_Information.php";
		break;
		case "MSDS":
            location.href = mainurl+"/support/Support_MSDS.php";
            break;
        case "SupportDownloadCatelog":
            location.href = mainurl+"/support/support_DownloadCatelog.php";
            break;
        case "sPombe":
            location.href = mainurl+"/products/spombe_Home.php";
            break;
        default:
            location.href = "Home.html";
            break;
    }        
}

function checkLoad() {
    var aParse = window.location.href.split("?");
    if (aParse.length > 1) {
        Load(aParse[1]);
    }
}

function AccountOpen() {
    //memorize the current src for contents
    if (oCurrentSrc==null) {
        oCurrentSrc=document.getElementById("oContents").src;
    }
    //open account.aspx
    document.getElementById("oContents").src="Account.aspx";
}
function AccountClose() {
    document.getElementById("oContents").src = oCurrentSrc;
    oCurrentSrc=null;
}

function ShowCart(sProductID) {
    if (document.getElementById("oContents").src.indexOf("Shopping_Cart") ==-1) {
        oCurrentSrc=document.getElementById("oContents").src;
    }
    setCrumb('Shopping Cart','','','');
    document.getElementById("oContents").src="cart.html";
    var sPort="";
    if (window.location.hostname.indexOf("www.questci.com") !=-1) {
        sPort=":450";
    }
    if (sProductID > "") {
        window.setTimeout("document.getElementById(\"oContents\").src=\"https://"+window.location.hostname+sPort+window.location.pathname+"Shopping_Cart.aspx?Add="+sProductID+"&CurrentSrc="+oCurrentSrc+"\";",3);
    } else {
        window.setTimeout("document.getElementById(\"oContents\").src=\"https://"+window.location.hostname+sPort+window.location.pathname+"Shopping_Cart.aspx?CurrentSrc="+oCurrentSrc+"\";",3);
    }
}

function CloseCart() {
    document.getElementById("oContents").src = oCurrentSrc;
    oCurrentSrc=null;
}

function EnterSearch(e)
{
    var keynum;
    var keychar;
    var numcheck;
    if(window.event) // IE
    {
        keynum = e.keyCode;
    }
    else if(e.which) // Netscape/Firefox/Opera
    {
        keynum = e.which;
    }
    if (keynum ==13) {
        Load('Search');
    }
}
    
