var isNav, isIE, isIE5, isIE50;
var coll = "";
var styleObj = "";
if (parseInt(navigator.appVersion) >= 4) {
  if (navigator.appName == "Netscape") {
    isNav = true;
  }
  else {
    isIE = true;
    coll = "all.";
    styleObj = ".style";
    if ((navigator.userAgent.indexOf("MSIE 5") != -1) ||
        (navigator.userAgent.indexOf("MSIE 6") != -1) ) {
		isIE5 = true;
      if (navigator.userAgent.indexOf("MSIE 5.0") != -1) {
        isIE50 = true;
      }
    }
  }
}
function getObjectStyle(obj) {
	return "document."+coll+obj+styleObj;
}
function getObjectName(obj) {
	return "document."+coll+obj+'.name';
}
function show(obj) {
	var theObj = getObjectStyle(obj);
	eval(theObj + '.position = "relative";');
	eval(theObj + '.visibility = "visible";');
}

function hide(obj) {
	var theObj = getObjectStyle(obj);
	eval(theObj + '.position = "absolute";');
	eval(theObj + '.visibility = "hidden";');
}

function onloadfocus(Form,Obj){
    if (Obj != null ) {
        if (Obj.type != "hidden" && Obj.disabled !=true) Obj.focus();
    } else {
        for (i=0;i<Form.length;i++) {
            if (Form.elements[i].type != "hidden" && Form.elements[i].type != "select-one" && Form.elements[i].type != "radio" && Form.elements[i].disabled !=true){
                Form.elements[i].focus();
                break;
            }
        }
    }
}
/*------------------------------------------------------------------------*/
//  ¸Þ´ºÁ¤ÀÇ
/*------------------------------------------------------------------------*/
function Home(){	
	window.location.href = "../../";
	return false;
}

function GoAdmin(){	
	window.location.href = "../../admin/frame/main.php";
	return false;
}

function GoNews(){
	window.location.href = "../../main/account/newsletter.php";
	return false;
}

function GoMain( code ){
	var gotourl = "";

	switch ( code ) {
		case "account":
			gotourl = "../../main/"+code+"/main.php";
			break;
		case "news":
			gotourl = "../../main/"+code+"/list.php";
			break;
		case "info":
			gotourl = "../../main/"+code+"/main.php";
			break;
		case "faq":
			gotourl = "../../main/"+code+"/list.php";
			break;
		case "about":
			gotourl = "../../main/"+code+"/main.php";
			break;
		case "contact":
			gotourl = "../../main/"+code+"/main.php";
			break;
		case "privacy":
			gotourl = "../../main/"+code+"/main.php";
			break;
		case "philosophy":
			gotourl = "../../main/company/main.php?&menucode=" + code;
			break;
		case "mailto":
			gotourl = "../../main/"+code+"/mailto.php";
			break;
		case "logout":
			gotourl = "../../main/account/logout.php";
			break;
		case "register":
			gotourl = "../../main/account/account.php";
			break;
		case "profile":
			gotourl = "../../main/account/account.php";
			break;
		case "wslogout":
			gotourl = "../../main/wholesale/logout.php";
			break;
		default:
			gotourl = "#";
	}
	window.location.href = gotourl;
	return false;
}

function GoPage( code ){
	window.location.href = "../../main/company/main.php?&no=" + code;
	return false;
}

function Wishlist(pageNum){
	if ( pageNum == null ) pageNum = 1;
	window.location.href = "../../main/myshop/wishlist.php?&page=" + pageNum;
	return false;
}

function MyProfile(){
	window.location.href = "../../main/account/edit.php";
	return false;
}


function ChangePasswd(){
	window.location.href = "../../main/account/passwd.php";
	return false;
}

function LostPW(){
	window.location.href = "../account/lostpasswd.php";
	return false;
}

function GoPrivacy( pageNum ){	
	if ( pageNum == null ) pageNum = 1;
	window.location.href = "../../main/privacy/main.php?&page=" + pageNum;
	return false;
}

function GoCategory( catcode ){	
	window.location.href = "../../main/shop/list.php?cat="+catcode;
	return false;
}

function GoCollection(catcode,colcode){
	window.location.href = "../../main/shop/list.php?cat="+catcode+"&col="+colcode;
	return false;
}
function GoBestSeller(){
	
	
}




function GoProduct( itemno , catcode ){	
	if ( catcode == null ) para = "";
	if ( catcode == "C000" && itemno =="" ) {
		GoCategory( catcode );
	} else {
		window.location.href = "../../main/shop/view.php?cat="+catcode+"&itemno="+itemno;
		return false;
	}
}
function ZoomIn ( itemno ) {
	if ( itemno != null ) {
		window.open('../../main/shop/zoomin.php?itemno='+itemno,'ZoomIn','width=520,height=630');
	}
}
function ColorChart ( colorno ) {
	if ( colorno != null ) {
		window.open('../../main/shop/colorchart.php?colorno='+colorno,'ColorChart','width=540,height=630,scrollbars');
	}
}



function MailToFriend( itemno , catcode ){	
	if ( catcode == null ) para = "";
	window.location.href = "../../main/mailto/mailto.php?cat="+catcode+"&itemno="+itemno;
	return false;
}
function InvoicePrint( ordersno ){
	window.open("/orders/print.php?ordersno="+ordersno,"PRINTFORM","width=660,height=600,scrollbars,menubar"); 
}
/*------------------------------------------------------------------------*/
//  µ¿¿µ»ó ÇÃ·¡½¬ ½ÇÇà
/*------------------------------------------------------------------------*/
function FlashPlay( src, width, height){	
	document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write ('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="');
	document.write (width);
	document.write ('" height="');
	document.write (height);
	document.write ('">');
	document.write ('<param name="movie" value="');
	document.write (src);
	document.write ('">');
	document.write ('<param name="quality" value="high">');
	document.write ('<param name="wmode" Value="Transparent">');
	document.write ('<embed src="');
	document.write (src);
	document.write ('" quality="high" ');
	document.write ('pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="');
	document.write (width);
	document.write ('" height="');
	document.write (height);
	document.write ('">');
	document.write ('</embed>');
	document.write ('</object>');
}
/*------------------------------------------------------------------------*/
//  ÀÌ¹ÌÁö Ãâ·Â
/*------------------------------------------------------------------------*/
function ResizeImage(img_obj,max_width,max_height,swap) {
	imgobj =  eval("document."+img_obj);

	if ( swap == "SWAP" ) {
		if ( imgobj.width < imgobj.height ) {
			swaptmp = max_width;
			max_width = max_height;
			max_height = swaptmp;
		}
	}
	var tmp = 1;
	if ( imgobj.width > max_width) {
		tmp = max_width / imgobj.width ;	//width°¡ maxwidthº¸´Ù Å«°æ¿ìÃà¼ÒÀ²
		if ( Number( imgobj.height * tmp ) > max_height) {
			tmp = Number(tmp * (max_height / (imgobj.height*tmp)));
		}
	} else if ( imgobj.height > max_height )	{ //width°¡ maxwidthº¸´Ù Å«°æ¿ìÃà¼ÒÀ²
		 tmp = Number(max_height / imgobj.height) ;
	}
	imgobj.width = Number( imgobj.width * tmp );
}
function img_View(img_name,width,height) {

	if ( img_name != null && img_name != "" ) {

		var win_scrollbars = 'no';
		var width_plus = 0;

		if (height > 600) {
			var win_scrollbars = 'yes';
			height = 600;
			var width_plus = 20;
		} 
		if (width > 800) {
			var win_scrollbars = 'yes';
			width = 800;
			var width_plus = 20;
		}

		var openwidth = Number(width) + width_plus + 2;
		var openheight = Number(height) + width_plus + 2;

		window.open('../../main/unionpgm/imgView.php3?img='+img_name,'','width='+openwidth+',height='+openheight+', toolbar=0,menubar=0,resizable=yes,scrollbars='+win_scrollbars+', top=50, left=50');
	}
}

function popCVV(){
	window.open('../../main/orders/card_identification.html','CVV','width=500,height=330,scrollbars');
	
}


function SizeChart (prodtype ) {
	sizeurl = "../../main/shop/"+prodtype+"_sizechart.html";
	if (prodtype== "ring"){
	window.open(sizeurl,'RingSize','width=700,height=560,scrollbars');
	}else{
	window.open(sizeurl,'BraceletSize','width=350,height=300,scrollbars');
	}
}


function getmetaContents(mn){
var m = document.getElementsByTagName('meta');
for(var i in m){
if(m[i].name == mn){
return m[i].content;
}
}
}


function TryShareOverlay(choice,title,img){
	var myURL = location.href.replace('https:','http:');
	curUrl = encodeURIComponent(myURL);
	//curTitle = "Harraca"
	//pageTitle = encodeURIComponent(document.title);
	pageTitle = encodeURIComponent(title);
	imageLink = "<img src='" + img + "'/>";
	imageLink = encodeURIComponent(imageLink);
	switch ( choice ) {
		case "delicious":
			gotourl = "http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url="+curUrl+"&amp;title=" + pageTitle;
			winname ="delicous";
			break;
		case "digg":
			gotourl = "http://digg.com/submit?phase=2&amp;url="+curUrl+"&amp;title=" + pageTitle;
			winname ="digg";
			break;
		case "facebook":
			gotourl = "http://www.facebook.com/sharer.php?u="+curUrl+"&t=" + pageTitle;
			winname ="facebook";
			break;
		case "mixx":
			gotourl = "http://www.mixx.com/submit?page_url="+curUrl+"&amp;title=" + pageTitle;
			winname ="mixx";
			break;
		case "myspace":
			var mycontent = getmetaContents('description');
			gotourl = "http://www.myspace.com/Modules/PostTo/Pages/?u="+curUrl+"&t=" + pageTitle + "&c=<p>" + mycontent + "<i>" + imageLink + "</i></p>&l=5";
			winname= "myspace";
			break;
		case "newsvine":
			gotourl = "http://www.newsvine.com/_tools/seed&amp;save?u="+curUrl+"&amp;h="+ pageTitle;
			break;
		case "yahoo":
			gotourl = "http://myweb2.search.yahoo.com/myresults/bookmarklet?u="+curUrl+"&amp;h=" + pageTitle;
			winname ="yahoo";
			break;
	}
	window.open(gotourl,winname,'toolbar=yes, scrollbars=yes,width=550,height=550'); 
	
	
}


function openPop( gotourl,winname){
	window.open(gotourl,winname,'scrollbars=yes,width=500,height=600'); 
	
}