
// only return 0-9 a-z or A-Z
function ValHandle1(o){
  o.value=o.value.replace(/([^0-9A-Za-z\x2D])/g,"");
}

// only return 0-9 a-z or A-Z
function ValHandle2(o){
  if(/[^0-9A-Za-z]/.test(o.value)){
    o.value=o.value.replace(/([^0-9A-Za-z\x2D])/g,"");
  }
}

// Macromedia Library functions for menu control
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function jump(menu){
  var loc = menu[menu.selectedIndex].value.split("|");
  if(loc.length == 2)
    window.open(loc[1], loc[0]);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

// This function tests any text cell for the presence of double width chars
function WidthTest(evt, option) {
	// option 0 = anything allowed
	// option 1 = auto convert double english to single
	// option 2 = error on double width english
	for (count=0; count<=evt.value.length; count++)	{
		teststring = evt.value
		testchar = teststring.substr(count, 1);
		testasc = testchar.charCodeAt()
		// option 1 dbl width english conversion
		if ((testasc > 65295) && (testasc < 65371) && (option == 1)) {
								evt.value = teststring.substr(0, count) + String.fromCharCode(testasc-65248) + teststring.substr(count+1, (teststring.length - (count+1)));
    							}
		// Convert full width Katakana to half width Katakana						
		if ((testasc >= 12450) && (testasc <= 12527) && (option == 1)) {
			//alert(testasc);
			result = "";
			if (testasc == 12450) {result = String.fromCharCode(65393);};
			if (testasc == 12452) {result = String.fromCharCode(65394);};
			if (testasc == 12454) {result = String.fromCharCode(65395);};
			if (testasc == 12456) {result = String.fromCharCode(65396);};
			if (testasc == 12458) {result = String.fromCharCode(65397);};
			
			if (testasc == 12459) {result = String.fromCharCode(65398);};
			if (testasc == 12460) {result = String.fromCharCode(65398) + String.fromCharCode(65438);};
			if (testasc == 12461) {result = String.fromCharCode(65399);};
			if (testasc == 12462) {result = String.fromCharCode(65399) + String.fromCharCode(65438);};
			if (testasc == 12463) {result = String.fromCharCode(65400);};
			if (testasc == 12464) {result = String.fromCharCode(65400) + String.fromCharCode(65438);};
			if (testasc == 12465) {result = String.fromCharCode(65401);};
			if (testasc == 12466) {result = String.fromCharCode(65401) + String.fromCharCode(65438);};
			if (testasc == 12467) {result = String.fromCharCode(65402);};
			if (testasc == 12468) {result = String.fromCharCode(65402) + String.fromCharCode(65438);};

			if (testasc == 12469) {result = String.fromCharCode(65403);};
			if (testasc == 12470) {result = String.fromCharCode(65403) + String.fromCharCode(65438);};
			if (testasc == 12471) {result = String.fromCharCode(65404);};
			if (testasc == 12472) {result = String.fromCharCode(65404) + String.fromCharCode(65438);};
			if (testasc == 12473) {result = String.fromCharCode(65405);};
			if (testasc == 12474) {result = String.fromCharCode(65405) + String.fromCharCode(65438);};
			if (testasc == 12475) {result = String.fromCharCode(65406);};
			if (testasc == 12476) {result = String.fromCharCode(65406) + String.fromCharCode(65438);};
			if (testasc == 12477) {result = String.fromCharCode(65407);};
			if (testasc == 12478) {result = String.fromCharCode(65407) + String.fromCharCode(65438);};

			if (testasc == 12479) {result = String.fromCharCode(65408);};
			if (testasc == 12480) {result = String.fromCharCode(65408) + String.fromCharCode(65438);};
			if (testasc == 12481) {result = String.fromCharCode(65409);};
			if (testasc == 12482) {result = String.fromCharCode(65409) + String.fromCharCode(65438);};
			if (testasc == 12484) {result = String.fromCharCode(65410);};
			if (testasc == 12485) {result = String.fromCharCode(65410) + String.fromCharCode(65438);};
			if (testasc == 12486) {result = String.fromCharCode(65411);};
			if (testasc == 12487) {result = String.fromCharCode(65411) + String.fromCharCode(65438);};
			if (testasc == 12488) {result = String.fromCharCode(65412);};
			if (testasc == 12489) {result = String.fromCharCode(65412) + String.fromCharCode(65438);};

			if (testasc == 12490) {result = String.fromCharCode(65413);};
			if (testasc == 12491) {result = String.fromCharCode(65414);};
			if (testasc == 12492) {result = String.fromCharCode(65415);};
			if (testasc == 12493) {result = String.fromCharCode(65416);};
			if (testasc == 12494) {result = String.fromCharCode(65417);};

			if (testasc == 12495) {result = String.fromCharCode(65418);};
			if (testasc == 12496) {result = String.fromCharCode(65418) + String.fromCharCode(65438);};
			if (testasc == 12497) {result = String.fromCharCode(65418) + String.fromCharCode(65439);};
			if (testasc == 12498) {result = String.fromCharCode(65419);};
			if (testasc == 12499) {result = String.fromCharCode(65419) + String.fromCharCode(65438);};
			if (testasc == 12500) {result = String.fromCharCode(65419) + String.fromCharCode(65439);};
			if (testasc == 12501) {result = String.fromCharCode(65420);};
			if (testasc == 12502) {result = String.fromCharCode(65420) + String.fromCharCode(65438);};
			if (testasc == 12503) {result = String.fromCharCode(65420) + String.fromCharCode(65439);};
			if (testasc == 12504) {result = String.fromCharCode(65421);};
			if (testasc == 12505) {result = String.fromCharCode(65421) + String.fromCharCode(65438);};
			if (testasc == 12506) {result = String.fromCharCode(65421) + String.fromCharCode(65439);};
			if (testasc == 12507) {result = String.fromCharCode(65422);};
			if (testasc == 12508) {result = String.fromCharCode(65422) + String.fromCharCode(65438);};
			if (testasc == 12509) {result = String.fromCharCode(65422) + String.fromCharCode(65439);};

			if (testasc == 12510) {result = String.fromCharCode(65423);};
			if (testasc == 12511) {result = String.fromCharCode(65424);};
			if (testasc == 12512) {result = String.fromCharCode(65425);};
			if (testasc == 12513) {result = String.fromCharCode(65426);};
			if (testasc == 12514) {result = String.fromCharCode(65427);};

			if (testasc == 12516) {result = String.fromCharCode(65428);};
			if (testasc == 12517) {result = String.fromCharCode(65429);};
			if (testasc == 12518) {result = String.fromCharCode(65429);};
			if (testasc == 12519) {result = String.fromCharCode(65430);};
			if (testasc == 12520) {result = String.fromCharCode(65430);};

			if (testasc == 12521) {result = String.fromCharCode(65431);};
			if (testasc == 12522) {result = String.fromCharCode(65432);};
			if (testasc == 12523) {result = String.fromCharCode(65433);};
			if (testasc == 12524) {result = String.fromCharCode(65434);};
			if (testasc == 12525) {result = String.fromCharCode(65435);};

			if (testasc == 12526) {result = String.fromCharCode(65436);};
			if (testasc == 12527) {result = String.fromCharCode(65436);};
					
			if (result != "") {		
					resultstring = teststring.substr(0, count) + result + teststring.substr(count+1, (teststring.length - (count+1)));
					evt.value = resultstring;
					//alert(result.charCodeAt());
								}
								}
		// option 2 dbl width english error						
		if ((testasc > 65295) && (testasc < 65371) && (option == 2)) {
								alert("<%=WebTextCart(7)%>");
									// No Double Width Chars Allowed!
								evt.value = "";
								evt.focus();
								evt.focus();
    							}

													}
}

//------------------------------ This for tree menu --------------------------------------
function Toggle(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")
   key=document.getElementById("X" + item);
   if (visible) {
     obj.style.display="none";
     key.innerHTML="<img src='/clientinc/template0/expand.gif' border=0>";
   } else {
      obj.style.display="block";
      key.innerHTML="<img src='/clientinc/template0/colapse.gif' border=0>";
   }
}

/*function Expand() {
   divs=document.getElementsByTagName("DIV");
   for (i=0;i<divs.length;i++) {
     divs[i].style.display="block";
     key=document.getElementById("X" + divs[i].id);
     key.innerHTML="<img src='/clientinc/template0/colapse.jpg' border=0>";
   }
}

function Collapse() {
   divs=document.getElementsByTagName("DIV");
   for (i=0;i<divs.length;i++) {
     divs[i].style.display="none";
     key=document.getElementById("X" + divs[i].id);
     key.innerHTML="<img src='/clientinc/template0/expand.jpg' border=0>";
   }
}*/
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}


//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["productframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="no"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 3 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids)
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids] : document.getElementById(iframeids)
	if (tempobj) {
		tempobj.style.display="block"
	}
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller