//var isIE = true;
//var isNS = 0;
//var isMac = 0;
//var isAOL = 0;

// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();

// *** BROWSER VERSION ***
// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
// If you want to allow spoofing, take out the tests for opera and webtv.
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                      (agt.indexOf("; nav") != -1)) );
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_gecko = (agt.indexOf('gecko') != -1);


var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

var winDisp;
var winCol;
var bSearch = true;

document.onkeydown = subS;

var MM_contentVersion = 6
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0
	
if (plugin) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ")
    for (var i = 0; i < words.length; ++i) {
		if (isNaN(parseInt(words[i]))) 
		continue
		var MM_PluginVersion = words[i]
	}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion
}else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n')
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n')
	document.write('</SCR' + 'IPT\> \n')
}

function doImg(ndx,JSsys) {
	
	oSelImg = document.images['iShop_' + ndx]
	frm = document.forms[1]
	
	//alert(frm.selCol.tagName)
	
	bSelCol = frm.selCol.tagName != 'SELECT'		
	if (bSelCol)
	    oSelCol = frm.selCol[ndx]
	else
	    oSelCol = frm.selCol	
		
	iSel = oSelCol.selectedIndex
	
	//alert(frm.selCol.length)
	
	if (bSelCol)
	    vTxtImg = eval("frm.txtI" + (iSel+2) + "[" + ndx + "].value")
	else
	    vTxtImg = eval("frm.txtI" + (iSel+2) + ".value")
	
	//alert(document.images['iShop'].length)
	//alert(oSelImg)
	
	if (iSel > 0 && vTxtImg != '')		
		oSelImg.src = '../../HS_images/' + JSsys + '/pics/' + vTxtImg		
}

function chkSelList() {

	oChks = document.getElementsByTagName('input')
	
	exChk = false

	for (i=0;i<oChks.length-2;i++) {
		if (oChks[i+2].checked) {
			exChk = true
		}	
	}			
	if (!exChk) {
		alert('There are no items selected...')
		return
	}	
	if (confirm('Are you sure you want to delete the selected items?')) {
		frm = document.forms[1]			
		frm.submit()
	}
}

function doSelAll() {

	oChks = document.getElementsByTagName('input')

	for (i=0;i<oChks.length-2;i++) {
		if (oChks['chkAll'].checked) {	
			oChks[i+2].checked = true
		}else{
			oChks[i+2].checked = false
		}	
	}			
}	

function doShop(ndx,g,l1,l2,o) {

	frm = document.forms[1]	
	
	////bSelCol = frm.selCol.length > 0
	bSelCol = frm.selCol.tagName != 'INPUT' && frm.selCol.tagName != 'SELECT'
	if (bSelCol) {
	    oSelCol = frm.selCol[ndx]
	    oTxtSelCol = frm.txtSelCol[ndx]
	    oTxtTitCol = frm.txtTitCol[ndx]	    
	}else{
	    oSelCol = frm.selCol	
	    oTxtSelCol = frm.txtSelCol	    
	    oTxtTitCol = frm.txtTitCol	    
	}
	
	////bSelSiz = frm.selSiz.length > 0
	bSelSiz = frm.selSiz.tagName != 'INPUT' && frm.selSiz.tagName != 'SELECT'
	if (bSelSiz) {
	    oSelSiz = frm.selSiz[ndx]
	    oTxtSelSiz = frm.txtSelSiz[ndx]
	    oTxtTitSiz = frm.txtTitSiz[ndx]	    
	}else{
	    oSelSiz = frm.selSiz
	    oTxtSelSiz = frm.txtSelSiz	
	    oTxtTitSiz = frm.txtTitSiz
	}
	   
	//alert(bSelCol)
	
	/*	
	alert(frm.selSiz)
	alert(l1)
	alert(l2)
	alert(frm.selSiz[ndx].value)	
	alert(g)
	alert(o)
	*/
	
	if (oSelCol && oSelCol.value == '0') {
	
		alert('Select ' + l1 + '...')
		oSelCol.focus()
	}else{
		if (oSelSiz && oSelSiz.value == '0') {
	
			alert('Select ' + l2 + '...')
			oSelSiz.focus()
		}else{
		
	        //alert(ndx)
		
			//if (frm.txtButts.value == 'add') {
			
			    frm.txtButts.value = 'add'
			    frm.txtSelect.value = ndx	

			    oTxtTitCol.value = l1
			    oTxtTitSiz.value = l2
			    
			    if (oSelCol.tagName == 'SELECT')		    
			        oTxtSelCol.value = oSelCol.options[oSelCol.selectedIndex].text			    
			    
			    if (oSelSiz.tagName == 'SELECT')
			        oTxtSelSiz.value = oSelSiz.options[oSelSiz.selectedIndex].text

				frm.action = "main.asp?qShop=add&t=grplst&g=" + g 
			
			//}else{
			//	frm.action = "main.asp?qShop=edit&t=shop&g=" + g + "&o=" + o
			//}
			
			frm.submit()
		}	
	}	
}

function inputCol(col,sObj,nC) {
	
	document.getElementById(sObj).value = col
	
	if (col == '') 
		document.getElementById('bCol' + nC).style.background = 'url(../../iBornFree/HS_images/Trans.gif)';			
	else {
		document.getElementById('bCol' + nC).style.background = ''
		document.getElementById('bCol' + nC).style.backgroundColor = '#' + col
		}
}

function blurCol(obj,nC) {

    //alert(obj.id)

	if (obj.value != '') {
		document.getElementById('bCol' + nC).style.background = ''
		document.getElementById('bCol' + nC).style.backgroundColor = '#' + obj.value
	}else{
		document.getElementById('bCol' + nC).style.background = 'url(HS_images/Trans.gif)'
	}	
}


function colPick(sCol,nC) {

obj = document.getElementById(sCol)

col = obj.value;
id = obj.id;

//alert(col)
//alert(id)
//alert(nC)

if (!winCol || winCol.closed) {
	winCol = window.open("../../HSoftCorpEyeCandy/HS_colors/ColorPicker.asp?c=" + col + '&id=' + id + '&nC=' + nC, "winCol", "dependent=true,width=320,height=178")
	if (!winCol.opener) {
		winCol.opener = window;
	}
}else{

	winCol.LoadColor(col,id,nC);
	
	////winCol.location.href = "../../HSoftCorpEyeCandy/HS_colors/ColorPicker.asp?c=" + col + '&id=' + id + '&nC=' + nC;
	
	winCol.focus();						
	}
}

function chkNum(o,e,p) {
		
	var frm = document.forms[1]		
	if (window.Event){
		uKey = e.which;
	}else{
		uKey = e.keyCode;
	}						

	var sNum = o.value

	var pnt = 46		
	if (p != 1 && sNum.indexOf('.') < 0) {				
		pnt = 45
	}	
	if (p == 2) {
		if (uKey == 37 && sNum.indexOf('%') < 0) pnt = 36		
	}
	
	if (!((uKey > pnt && uKey < 58) && uKey != 47)) {
	
		if (uKey == 0 || uKey == 8) {
			
			return true
				
		}else{			
			return false
		}		
	}else{			
		return true	
	}
}


function doNew(act) {			
	var frm = document.forms[1]
	if (act == 1 || frm.selAcc.value > 0) {
	    if (act == 1)
		    frm.txtTy.value = 0
	    else
		    frm.txtTy.value = frm.selAcc.value
		    
		frm.submit()
	}else{			
		//alert('Select the type of account...')
		frm.selAcc.focus()
	}			
}		


function showhiRes(c,g,s,q,l1,l2,i,o) {
if (!winDisp || winDisp.closed) {
	winDisp = window.open("main.asp?t=display&c=" + c, "winDisp", "dependent=true,width=830,height=568") 	
	//+ "&t=display&g=" + g + "&s=" + s + "&q=" + q + "&l1=" + l1 + "&l2=" + l2 + "&i=" + i + "&o=" + o, "winDisp", "dependent=true,width=850,height=680")
	if (!winDisp.opener) {
		winDisp.opener = window;
	}
}else{
	//winDisp.setImg(c);
	winDisp.location.href = "main.asp?t=display&c=" + c 
	//+ "&t=display&g=" + g + "&s=" + s  + "&q=" + q + "&l1=" + l1 + "&l2=" + l2 + "&i=" + i + "&o=" + o;
	winDisp.focus();						
	}		
}


function display(c,g,s,q,l1,l2,i,o) {
if (!winDisp || winDisp.closed) {
	winDisp = window.open("HS_display.asp?c=" + c + "&t=display&g=" + g + "&s=" + s + "&q=" + q + "&l1=" + l1 + "&l2=" + l2 + "&i=" + i + "&o=" + o, "winDisp", "dependent=true,width=850,height=680")
	if (!winDisp.opener) {
		winDisp.opener = window;
	}
}else{
	//winDisp.setImg(c);
	winDisp.location.href = "HS_display.asp?c=" + c + "&t=display&g=" + g + "&s=" + s  + "&q=" + q + "&l1=" + l1 + "&l2=" + l2 + "&i=" + i + "&o=" + o;
	winDisp.focus();						
	}		
}

function refShop(t,g,s) {
	document.location.href = "main.asp?t=" + t + "&g=" + g + "&o=" + s;
}

function subS(e) {
	if (window.Event){
		entKey = e.which;
		if (entKey == 13) {
			goSubmit();
		}
	}else{
		entKey = event.keyCode;
	}
}

function goSubmit(a) {	

	if (a == 'a' || a == 'anc') {	
	
		var frm = document.forms[0];
		frm.submit();
	}
}

function finShop(u,url,ssl,uType,pCur,wsMin) {

	//alert(u)
	
	frm = document.forms[1];

    bAuth = (u != null && u != "")

	
	//alert(frm.selCo.selectedIndex)	
	//alert(frm.order.value)
	
	if (bAuth) {

        if (uType == 2 && Math.round(Number(frm.tSub.value), 2) < wsMin) {
        
            alert('Wholesale order minimum is ' + pCur + ' ' + wsMin)
	        return	    
	    }
	    
	}else{
	
	    //if (ssl == 1)
	    //    frm.action = "https://ibornfree.net/GuapoSkins/main.asp?t=login&o=" + frm.order.value;
	    //else	
	          
	    frm.action = "main.asp?t=login&o=" + frm.order.value;
	        
	    frm.submit();
	    return
	}
	
	if (frm.selCo.selectedIndex > 0) {    
	
	    ////ship = frm.selCo.value
	    ////iCpos = ship.indexOf('|')
	    
	    //alert(ship)
	    //alert(ship.substr(iCpos, ship.length - iCpos))
	    
	    ////if (ship.substr(iCpos, ship.length - iCpos) == '|0|0|0|0|0|0|0|0|0|')
	    ////	{
	    ////    alert('Sorry, but we currently do not ship to the country you selected.')
        ////    frm.selCo.selectedIndex = 0
        ////    frm.selCo.focus()	        
	    ////return
	    ////}
	
	    if (!frm.chkAgree.checked) {
	    	    
	        alert('You need to read and agree to the Terms & Conditions...');
	        frm.chkAgree.focus();
	    }else{	
	    
		    //alert(u)
		
		    if (bAuth) {
		    
			    if (url != 'pay' && url != 'LinkPoint') {
			    
			        /*
			        if (url == "LinkPoint")			        
			        {
			            url = "../../HSoftCorpEyeCandy/HS_payments/LinkPoint.asp"		        
				        frm.action = "main.asp?t=" + url;
				    }    
			        else
			        {
			        */
			        
				    frm.PARAMPLUS.value = 'sCFre=' + frm.tFre.value + '&' +
										    'sCTax=' + frm.tTax.value;
				    frm.action = url;
				    
				    //}
				    
			    }else{
				    frm.action = "main.asp?t=" + url;
			    }	
		    }else{				
			    //sfx = '';
			    //if (url == 'pay') {sfx = '&HSpay=' + url}				    				
			    //frm.action = "main.asp?t=accts" + sfx;
			    
			    frm.action = "main.asp?t=login&o=" + frm.order.value;
		    }
		    frm.submit();
		}
	}else{
   	    alert('Select the country where you want the items to be posted. ' +
                  '                                                            Different freight fees and taxes may apply...');
		frm.selCo.focus();	
	}	
}	

function goM(url,t,g,s,u,w) {

	if (t == 'group') {
		document.location.href = 'main.asp?t='+t+'&g='+g+'&s='+s+'&m='+s+'&u='+u;
	}else{
		if (url != '') {
		
		    url = "http://" + url;
			
			if (w == 2) {
				//if (!winDisp || winDisp.closed) {
					winDisp = window.open(url, "winDisp")
					//if (!winDisp.opener) {
						winDisp.opener = window;
					//}
				//}else{
				//	winDisp.location.href = url
					winDisp.focus();						
				//}
			////}else if (w == 0) {
			////	document.location.href = 'main.asp?url='+url+'&t='+t+'&g='+g+'&s='+s+'&m='+s+'&u='+u;
			}else{
				document.location.href = url
			}	
		}else{
		    if (t == 'grplst' && s == null)
    		    document.location.href = 'main.asp?t=' + t + '&g='+g;
            else		
			    document.location.href = 'main.asp?g='+g+'&s='+s+'&u='+u;
		}	
	}	
}


function hiView(o) {o.className ="vieH"}
function loView(o) {o.className = "view"}	

function hiBoxMenu(o) {o.className ="bStMenH"}
function loBoxMenu(o) {o.className = "bStMenu"}

function ancU(o,cl) {

	if (cl == 'anHd') o.className = "anHdH"
	else if (cl == 'anDn') o.className = "anDnH"
	else if (cl == 'anHi') o.className = "anHiH"
	else if (cl == 'anFt') o.className = "anFtH"
	else
		o.className = "sH"
}

function ancD(o,cl) {

	if (cl != null && cl != '') 
		o.className = cl
	else
		o.className = "s"
}

function hiA(o) {o.className = "aH";}
function loA(o) {o.className = "";}

function NOancM(o) {if (o != null) {o.className = "mM"}}

function hiImgView(a) {

	//o = cbeGetElementById('vi' + a)
	//o.className ="vieH"
}
function loImgView(a) {

	//o = cbeGetElementById('vi' + a)
	//o.className = "view"
}
