
function nomad(chaine){
	if( (chaine == '') || ( ( (chaine.indexOf("*") != -1) && (chaine.indexOf("*") < NbreCar) ) || ( (chaine.indexOf("%") != -1) && (chaine.indexOf("%") < NbreCar) ) ) )
		return true;
	else return false;
}

// KOMPASS SEARCH FUNCTION START
url_kiserver = "http://www.kompass.com/kinl/";

function verifSaisie(formu)
{
	list  = "";
	myChoice = 0;
	myType = 0;
	myLang = "en";
	myActivity = "";
	selection =0;

   if (formu._Choix[0].checked == true)
   {
		search_type = formu._Choix[0].value;

		if (search_type != 'GS')
		{

			if (nomad(formu._Keyword.value))
			{
				alert("You must enter at least 3 characters before * or % symbols");
				formu._Keyword.focus();
				return false;
			}
		}

   } else if (formu._Choix[1].checked == true)
   {
		search_type = formu._Choix[1].value;

		if (search_type != 'GS')
		{

			if (nomad(formu._Keyword.value))
			{
				alert("You must enter at least 3 characters before * or % symbols");
				formu._Keyword.focus();
				return false;
			}
		}
   }

	switch (search_type)
	{
	case 'KW' : //Keyword

		if(formu._Keyword.value == '' )
		{
			// search word(s) missing - quietly ignore this request
			return;
		}
		//busy_mark (true);
		formu._Prod.value= "ACTI2";
		formu._Typerech.value= "1";
		formu._Choice.value="company";
		formu._Description.value = "";
		formu._Action.value="31";
		formu._Prevact.value="SOCRECH";
		formu._Path.value="";
		formu._Secteur.value="SOC";
		formu._Page.value="comp_list";
		formu._Cgi.value=url_kiserver+"cgi-bin/KINL_SOCaction.cgi";
		//formu.action=url_kiserver+"cgi-bin/KINL_SOCaction.cgi";
		formu.submit();
		//OpenKompassWindow(formu);
		break;

	case 'PS' : //Products & services

		if(formu._Keyword.value == '' )
		{
			// search word(s) missing - quietly ignore this request
			return;
		}

		//busy_mark (true);
		formu._Action.value="21";
		formu._Prevact.value="PRORECH";
		formu._Page.value="";
		formu._Path.value="";
		formu._Level.value="";
		formu._Secteur.value="SOC";
		formu._Typerech.value="";
		formu._Prod.value="";
		formu._Nbpage.value="1";
		formu._Pgdebut.value="1";
		formu._Choice.value="product";
		formu._Cgi.value=url_kiserver+"cgi-bin/KINL_PROaction.cgi";
		//formu.action=url_kiserver+"/cgi-bin/KINL_PROaction.cgi";
		formu.submit();
		//OpenKompassWindow(formu);

		break;

	case 'GS' : //Guided search

		if(formu._Keyword.value != '' )
		{
			alert ("Search word(s) are ignored in guided searches");
		}

		formu._Action.value="49_RECGUIDEE";
		formu._Page.value="classif";
		formu._Path.value="classif";
		formu._Level.value="1";
		formu._Cgi.value=url_kiserver+"cgi-bin/KINL_PROaction.cgi";
		//formu.action=url_kiserver+"cgi-bin/KINL_PROaction.cgi";
		formu.submit();
		//OpenKompassWindow(formu);
		break;

	case 'CN' :  // company name
	case 'TN' :  // trade name
	case 'EN' :  // executive

		if(formu._Keyword.value == '' )
		{
			// search word(s) missing - quietly ignore this request
			return;
		}

		//busy_mark (true);
		formu._Action.value="46_det_fic";
		formu._Prevact.value="SOCRECH";
		formu._Typerech.value= "1";
		formu._Description.value= "";
		formu._Path.value="";
		formu._Prod.value="";
		formu._Secteur.value="SOC";
		formu._Level.value="";
		formu._Choice.value="";
		formu._Page.value="comp_list";
		formu._Cgi.value=url_kiserver+"cgi-bin/KINL_SOCaction.cgi";
		//formu.action=url_kiserver+"cgi-bin/KINL_SOCaction.cgi";
		formu.submit();
		//OpenKompassWindow(formu);
		break;

	default:
		alert ("Bugcheck: unexpected search type ["+search_type+"]" );
		return;
		break;
	}
}
// KOMPASS SEARCH FUNCTION END

function SearchX()
{
	with ( document.srchForm )
	{
		if (keyword.value == "")
		{
			alert("Please Enter your keyword..");
			keyword.focus();
			return false;
		}

		sgubun_select();

		submit();
	}
}
function sgubun_select(){
	with ( document.srchForm ){
		if ( sgubun.options[sgubun.selectedIndex].value == "1" )
			action = "/local/search/EbiznjoyProductSearch.jsp"
		else if ( sgubun.options[sgubun.selectedIndex].value == "2" )
			action = "/local/search/EbiznjoyOfferSearch.jsp";
		else if ( sgubun.options[sgubun.selectedIndex].value == "3" )
			action = "/local/search/EbiznjoyCompanySearch.jsp"
		else
		{
			alert('select selection partition.');
			return false;
		}
	}
}

var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function CheckUIElements(){
	var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

	if ( bNetscape4plus ) {
		yMenuFrom   = document["Layer1"].top;
		yMenuTo     = top.pageYOffset + 125; //³Ý½ºÄÉÀÌÇÁ¿ë ÃÖÃÊ ·¹ÀÌ¾î ÁÂÇ¥ °ª
	}
	else if ( bExplorer4plus ) {
		yMenuFrom   = parseInt (Layer1.style.top, 10);
		yMenuTo     = document.body.scrollTop + 125; //ÀÍ½ºÇÃ·Î·¯¿ë ÃÖÃÊ ·¹ÀÌ¾î ÁÂÇ¥ °ª
	}

	timeoutNextCheck = 500;

	if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
		setTimeout ("CheckUIElements()", timeoutNextCheck);
		return;
	}

	if ( yButtonFrom != yButtonTo ) {
		yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
		if ( yButtonTo < yButtonFrom )
			yOffset = -yOffset;

		if ( bNetscape4plus )
			document["divLinkButton"].top += yOffset;
		else if ( bExplorer4plus )
			divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

		timeoutNextCheck = 10;
	}
	if ( yMenuFrom != yMenuTo ) {
		yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
		if ( yMenuTo < yMenuFrom )
			yOffset = -yOffset;

			if ( bNetscape4plus )
				document["Layer1"].top += yOffset;
			else if ( bExplorer4plus )
				Layer1.style.top = parseInt (Layer1.style.top, 10) + yOffset;

			timeoutNextCheck = 10;
	}

	setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function OnLoad()
{
	var y;
	if ( top.frames.length )
	if ( bNetscape4plus ) {
		document["Layer1"].top = top.pageYOffset + 280; //³Ý½ºÄÉÀÌÇÁ¿ë ·Îµù½Ã ½ÃÀÛ ·¹ÀÌ¾î ÁÂÇ¥ °ª
		document["Layer1"].visibility = "visible";
	}	else if ( bExplorer4plus ) {
		Layer1.style.top = document.body.scrollTop + 280; //ÀÍ½ºÇÃ·Î·¯¿ë ·Îµù½Ã ½ÃÀÛ ·¹ÀÌ¾î ÁÂÇ¥ °ª
		Layer1.style.visibility = "visible";
	}
	CheckUIElements();

	return true;
}

function GetCookie (name) {
	var index = document.cookie.indexOf(name + "=");
	if (index == -1) return null;
		index = document.cookie.indexOf("=", index) + 1;
		var endstr = document.cookie.indexOf(";", index);
	if (endstr == -1) endstr = document.cookie.length;
		return unescape(document.cookie.substring(index, endstr));
}
function SetCookie (name, value) {
	var argv =  SetCookie.arguments;	//variable name, value ...
	var argc =  SetCookie.arguments.length;		//variable °¹¼ö
	var expires =  (2 < argc) ? argv[2] : null;
	var path =  (3 < argc) ? argv[3] : "/";
	var domain =  ".ebiznjoy.com";
	var secure =  (5 < argc) ? argv[5] : false;
	document.cookie =  name + "= " + escape (value) +
		((expires ==  null) ? "" : ("; expires= " + expires.toGMTString())) +
		((path ==  null) ? "" : ("; path= " + path)) +
		((domain ==  null) ? "" : ("; domain= " + domain)) +
		((secure ==  true) ? "; secure" : "");
}
function DisplayInfo(url, memberid, catalog_id, gcnm, sPath) {
	if(navigator.cookieEnabled){	//ÄíÅ° Çã¿ëµÈ´Ù¸é
		var expdate =  new Date();
		var todayProduct1 = "";
		var todayProduct2 = "";
		var todayProduct3 = "";
		var todayProduct4 = "";
		var str = "";
		var arr = new Array();

		expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000)); //1 day

		str = url+","+memberid+","+catalog_id+","+gcnm+","+sPath;

		if(DisplayInfo.arguments.length==5) {
			if(GetCookie("todayProduct1")!=null){ todayProduct1 = GetCookie("todayProduct1");}else{todayProduct1="";}
			if(GetCookie("todayProduct2")!=null){ todayProduct2 = GetCookie("todayProduct2");}else{todayProduct2="";}
			if(GetCookie("todayProduct3")!=null){ todayProduct3 = GetCookie("todayProduct3");}else{todayProduct3="";}
			if(GetCookie("todayProduct4")!=null){ todayProduct4 = GetCookie("todayProduct4");}else{todayProduct4="";}

			if(str!=todayProduct1 && str!=todayProduct2 && str!=todayProduct3 && str!=todayProduct4){
				SetCookie("todayProduct1", str, expdate);
				SetCookie("todayProduct2", todayProduct1, expdate);
				SetCookie("todayProduct3", todayProduct2, expdate);
				SetCookie("todayProduct4", todayProduct3, expdate);

				Layer1.style.display="";

				if(GetCookie("todayProduct1")!=null){
					arr = GetCookie("todayProduct1").split(",");
					img1.innerHTML = "<table width=48 height=48 border=0 cellpadding=0 cellspacing=1 bgcolor=#CCCCCC><tr><td bgcolor=#FFFFFF><a href=\"http://www.ebiznjoy.com/co/"+arr[0]+"/"+arr[1]+"/"+arr[2]+"/"+arr[3]+".html\" target='_blank'><img src=\""+arr[4]+"\" width=48 height=48 border=0></a></td></tr></table>";
				}
				if(GetCookie("todayProduct2")!=null){
					arr = GetCookie("todayProduct2").split(",");
					img2.innerHTML = "<table height=10><tr><td></td></tr></table><table width=48 height=48 border=0 cellpadding=0 cellspacing=1 bgcolor=#CCCCCC><tr><td bgcolor=#FFFFFF><a href=\"http://www.ebiznjoy.com/co/"+arr[0]+"/"+arr[1]+"/"+arr[2]+"/"+arr[3]+".html\" target='_blank'><img src=\""+arr[4]+"\" width=48 height=48 border=0></a></td></tr></table>";
				}
				if(GetCookie("todayProduct3")!=null){
					arr = GetCookie("todayProduct3").split(",");
					img3.innerHTML = "<table height=10><tr><td></td></tr></table><table width=48 height=48 border=0 cellpadding=0 cellspacing=1 bgcolor=#CCCCCC><tr><td bgcolor=#FFFFFF><a href=\"http://www.ebiznjoy.com/co/"+arr[0]+"/"+arr[1]+"/"+arr[2]+"/"+arr[3]+".html\" target='_blank'><img src=\""+arr[4]+"\" width=48 height=48 border=0></a></td></tr></table>";
				}
				if(GetCookie("todayProduct4")!=null){
					arr = GetCookie("todayProduct4").split(",");
					img4.innerHTML = "<table height=10><tr><td></td></tr></table><table width=48 height=48 border=0 cellpadding=0 cellspacing=1 bgcolor=#CCCCCC><tr><td bgcolor=#FFFFFF><a href=\"http://www.ebiznjoy.com/co/"+arr[0]+"/"+arr[1]+"/"+arr[2]+"/"+arr[3]+".html\" target='_blank'><img src=\""+arr[4]+"\" width=48 height=48 border=0></a></td></tr></table>";
				}
			}
		}
	}
}

function displayLayer()
{
	if(GetCookie("todayProduct1")!=null){
		Layer1.style.display="";
		arr = GetCookie("todayProduct1").split(",");
		img1.innerHTML = "<table width=48 height=48 border=0 cellpadding=0 cellspacing=1 bgcolor=#CCCCCC><tr><td bgcolor=#FFFFFF><a href=\"http://www.ebiznjoy.com/co/"+arr[0]+"/"+arr[1]+"/"+arr[2]+"/"+arr[3]+".html\" target='_blank'><img src=\""+arr[4]+"\" width=48 height=48 border=0></a></td></tr></table>";
	}
	if(GetCookie("todayProduct2")!=null){
		arr = GetCookie("todayProduct2").split(",");
		img2.innerHTML = "<table height=10><tr><td></td></tr></table><table width=48 height=48 border=0 cellpadding=0 cellspacing=1 bgcolor=#CCCCCC><tr><td bgcolor=#FFFFFF><a href=\"http://www.ebiznjoy.com/co/"+arr[0]+"/"+arr[1]+"/"+arr[2]+"/"+arr[3]+".html\" target='_blank'><img src=\""+arr[4]+"\" width=48 height=48 border=0></a></td></tr></table>";
	}
	if(GetCookie("todayProduct3")!=null){
		arr = GetCookie("todayProduct3").split(",");
		img3.innerHTML = "<table height=10><tr><td></td></tr></table><table width=48 height=48 border=0 cellpadding=0 cellspacing=1 bgcolor=#CCCCCC><tr><td bgcolor=#FFFFFF><a href=\"http://www.ebiznjoy.com/co/"+arr[0]+"/"+arr[1]+"/"+arr[2]+"/"+arr[3]+".html\" target='_blank'><img src=\""+arr[4]+"\" width=48 height=48 border=0></a></td></tr></table>";
	}
	if(GetCookie("todayProduct4")!=null){
		arr = GetCookie("todayProduct4").split(",");
		img4.innerHTML = "<table height=10><tr><td></td></tr></table><table width=48 height=48 border=0 cellpadding=0 cellspacing=1 bgcolor=#CCCCCC><tr><td bgcolor=#FFFFFF><a href=\"http://www.ebiznjoy.com/co/"+arr[0]+"/"+arr[1]+"/"+arr[2]+"/"+arr[3]+".html\" target='_blank'><img src=\""+arr[4]+"\" width=48 height=48 border=0></a></td></tr></table>";
	}
}

function userCookie(name)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen=document.cookie.length;
	var i=0;
	while(i< clen){
		var j = i+alen;
		if(document.cookie.substring(i,j)==arg) {
			var end = document.cookie.indexOf(";",j);
			if (end == -1) {
				end = document.cookie.length;
			}
			return unescape(document.cookie.substring(j,end));
		}
		i = document.cookie.indexOf(" ",i)+1;
		if (i==0) {
			break;
		}
	}
	return null;
}

function goAdvSearch()
{
	var pm = "";
	if(srchForm.sgubun.value=="1"){
		pm = "product";
	}else if(srchForm.sgubun.value=="2"){
		pm = "trade";
	}else if(srchForm.sgubun.value=="3"){
		pm = "company";
	}
	location.href="/AdvancedSearch.html?pm="+pm;
}
