var i = 0;
var whichLayer = null;
var whichBorder = null;
var which = 'innerLeftEditBoxText';
var _fontSize;
var whichEdit = null;

function updateText(changeLayer, text, whichEdit) 
{
	if(text == "") {text = " ";}
	myString = text;

	myString = myString.replace(/\r\n/g,"<BR>");
	myString = myString.replace(/\n\r/g,"<BR>");
	myString = myString.replace(/\r/g,"<BR>");
	myString = myString.replace(/\n/g,"<BR>");
	myString = myString.replace(/&/g,"&amp;");
	myString = myString.replace(/_/g," ");
	
	getPageElement(changeLayer).innerHTML = myString;
	getPageElement(whichEdit).value = myString;
}
function updateInnerText(changeLayer, text, whichEdit) 
{
	if(changeLayer == null) {
		setSelection('innerLeftEditBoxText','innerLeftEditBox','_0');
		changeLayer = 'innerLeftEditBoxText';
		whichEdit = '_0';
	}
	if(text == "") {text = " ";}
	myString = text;

	myString = myString.replace(/\r\n/g,"<BR>");
	myString = myString.replace(/\n\r/g,"<BR>");
	myString = myString.replace(/\r/g,"<BR>");
	myString = myString.replace(/\n/g,"<BR>");
	myString = myString.replace(/&/g,"&amp;");
	myString = myString.replace(/_/g," ");

	getPageElement(changeLayer).innerHTML = myString;
	getPageElement('text_value'+whichEdit).value = myString;
}

function getPageElement(sElement) 
{
	return document.getElementById(sElement);
}
function swapImg(whatImg) {
	if(i<1) {
		document.getElementById('card_placement').src = whatImg;
	}
}
function fixImg(whatImg, cardName, cardNum, artistName, cardType, artistID, is_upload) {
	document.getElementById('card_placement').src = whatImg;
	//document.getElementById('card_info').innerHTML="<a href=\"lgView.aspx?cardID="+cardNum+"\" onclick=\"var w = window.open(this.href,'console','width=377,height=532,scrollbars=0'); w.focus(); return false;\" onkeypress=\"window.open(this.href,'console','width=377,height=532,scrollbars=0'); return false;\"><img src=\"images/mag.gif\" id=\"mag\" /></a>";
	document.getElementById('card_info').innerHTML = "<input type=\"image\" src=\"images/mag.gif\" alt=\"Click to enlarge card\" id=\"mag\">" + "<br />";
	document.getElementById('card_info').innerHTML+="card id:" +cardNum+"<br />";
	document.getElementById('card_info').innerHTML+="card name:" +cardName+"<br />";
	document.getElementById('card_info').innerHTML+="artist name:" +artistName+"<br /><br />";
	document.getElementById('card_info').innerHTML+="<a href=\"cardDisplay.aspx?state=cards&cardOffset=0&cardArtist="+artistID+"&pn=1\">&bull;&nbsp;more from this artist</a><br />";
	var urlimg = "<img src=\"resources/generic/uploads/" + cardNum + "_lg_preview_static.jpg\" />";
	$(document).ready(function () {
	    $('#mag').click(function () {
	        $.blockUI({
	            message: urlimg,
	            css: {
	                top: ($(window).height() - 500) / 2 + 'px',
	                left: ($(window).width() - 500) / 2 + 'px',
	                width: '377px'
	            }
	        });

	        setTimeout($.unblockUI, 4000);
	    });
	    $('.blockOverlay').attr('mag', 'Click to close').click($.unblockUI);
	}); 
    if(is_upload == 0) {
		cardRef = "cardEdit.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
	} else if(cardNum == 1397) {
		cardRef = "cardEdit.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
	} else {
		cardRef = "uploads.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
	}
	i = 1;
}
function fixVImg(whatImg, cardName, cardNum, artistName, cardType, artistID, is_upload) {
	document.getElementById('card_placement').src = whatImg;
	//document.getElementById('vol_card_info').innerHTML="<a href=\"lgView.aspx?cardID="+cardNum+"\" onclick=\"var w = window.open(this.href,'console','width=377,height=532,scrollbars=0'); w.focus(); return false;\" onkeypress=\"window.open(this.href,'console','width=377,height=532,scrollbars=0'); return false;\"><img src=\"images/vmag.gif\" id=\"vmag\" /></a>";
	document.getElementById('vol_card_info').innerHTML = "<input type=\"image\" src=\"images/vmag.gif\" alt=\"Click to enlarge card\" id=\"vmag\">" + "<br />";
	document.getElementById('vol_card_info').innerHTML+="card id:" +cardNum+"<br />";
	document.getElementById('vol_card_info').innerHTML+="card name:" +cardName+"<br />";
	document.getElementById('vol_card_info').innerHTML += "artist name:" + artistName + "<br /><br />";
	var urlimg = "<img src=\"resources/generic/uploads/" + cardNum + "_lg_preview_static.jpg\" />";
	$(document).ready(function () {
	    $('#vmag').click(function () {
	        $.blockUI({
	            message: urlimg,
	            css: {
	                top: ($(window).height() - 500) / 2 + 'px',
	                left: ($(window).width() - 500) / 2 + 'px',
	                width: '377px'
	            }
	        });

	        setTimeout($.unblockUI, 4000);
	    });
	    $('.blockOverlay').attr('vmag', 'Click to close').click($.unblockUI);
	}); 
	if(is_upload == 0) {
		cardRef = "cardEdit.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
	} else if(cardNum == 1397) {
		cardRef = "cardEdit.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
	} else {
		cardRef = "uploads.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
	}
	i = 1;
}
function dispInfo(cardName, cardNum, artistName, cardType, artistID, is_upload) {
	if(i<1) {
		//document.getElementById('card_info').innerHTML="<a href=\"lgView.aspx?cardID="+cardNum+"\" onclick=\"var w = window.open(this.href,'console','width=377,height=532,scrollbars=0'); w.focus(); return false;\" onkeypress=\"window.open(this.href,'console','width=377,height=532,scrollbars=0'); return false;\"><img src=\"images/mag.gif\" id=\"mag\" /></a>";
		document.getElementById('card_info').innerHTML = "<input type=\"image\" src=\"images/mag.gif\" alt=\"Click to enlarge card\" id=\"mag\">" + "<br />";
		document.getElementById('card_info').innerHTML+="card id:" +cardNum+"<br />";
		document.getElementById('card_info').innerHTML+="card name:" +cardName+"<br />";
		document.getElementById('card_info').innerHTML+="artist name:" +artistName+"<br /><br />";
		document.getElementById('card_info').innerHTML+="<a href=\"cardDisplay.aspx?state=cards&cardOffset=0&cardArtist="+artistID+"&pn=1\">&bull;&nbsp;more from this artist</a><br />";
		var urlimg = "<img src=\"resources/generic/uploads/" + cardNum + "_lg_preview_static.jpg\" />";
		$(document).ready(function () {
		    $('#mag').click(function () {
		        $.blockUI({
		            message: urlimg,
		            css: {
		                top: ($(window).height() - 500) / 2 + 'px',
		                left: ($(window).width() - 500) / 2 + 'px',
		                width: '377px'
		            }
		        });

		        setTimeout($.unblockUI, 4000);
		    });
		    $('.blockOverlay').attr('mag', 'Click to close').click($.unblockUI);
		}); 
		if(is_upload == 0) {
			cardRef = "cardEdit.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
		} else if(cardNum == 1397) {
			cardRef = "cardEdit.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
		} else {
			cardRef = "uploads.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
		}
	}
}
function dispVInfo(cardName, cardNum, artistName, cardType, artistID, is_upload) {
	if(i<1) {
		//document.getElementById('vol_card_info').innerHTML="<a href=\"lgView.aspx?cardID="+cardNum+"\" onclick=\"var w = window.open(this.href,'console','width=377,height=532,scrollbars=0'); w.focus(); return false;\" onkeypress=\"window.open(this.href,'console','width=377,height=532,scrollbars=0'); return false;\"><img src=\"images/vmag.gif\" id=\"vmag\" /></a>";
	    document.getElementById('vol_card_info').innerHTML = "<input type=\"image\" src=\"images/vmag.gif\" alt=\"Click to enlarge card\" id=\"vmag\">" + "<br />";
		document.getElementById('vol_card_info').innerHTML+="card id:" +cardNum+"<br />";
		document.getElementById('vol_card_info').innerHTML+="card name:" +cardName+"<br />";
		document.getElementById('vol_card_info').innerHTML += "artist name:" + artistName + "<br /><br />";
		var urlimg = "<img src=\"resources/generic/uploads/" + cardNum + "_lg_preview_static.jpg\" />";
		$(document).ready(function () {
		    $('#vmag').click(function () {
		        $.blockUI({
		            message: urlimg,
		            css: {
		                top: ($(window).height() - 500) / 2 + 'px',
		                left: ($(window).width() - 500) / 2 + 'px',
		                width: '377px'
		            }
		        });

		        setTimeout($.unblockUI, 4000);
		    });
		    $('.blockOverlay').attr('vmag', 'Click to close').click($.unblockUI);
		}); 
		if(is_upload == 0) {
			cardRef = "cardEdit.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
		} else if(cardNum == 1397) {
			cardRef = "cardEdit.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
		} else {
			cardRef = "uploads.aspx?state=cards&mode=size&cardID="+cardNum+"&aName="+artistName+"&cName="+cardName+"&cType="+cardType;
		}
	}
}
function goTo(where) {
	location.href = where;
}
function goToUpload(where) {
	location.href = where;
}
function showFullDetails(aName, cName, cType, cardID) {
	//alert(aName+","+cName+","+cType+","+cardID);
	if(cType == "c"){var finish = "Coated";}
	if(cType == "u"){var finish = "Uncoated";}
	//document.getElementById('card_full_info').innerHTML="<a href=\"lgView.aspx?cardID="+cardID+"\" onclick=\"var w = window.open(this.href,'console','width=377,height=532,scrollbars=0'); w.focus(); return false;\" onkeypress=\"window.open(this.href,'console','width=377,height=532,scrollbars=0'); return false;\"><img src=\"images/mag.gif\" id=\"mag_s\" /></a>";
	document.getElementById('card_full_info').innerHTML = "<input type=\"image\" src=\"images/mag.gif\" alt=\"Click to enlarge card\" id=\"mag_s\">" + "<br />";
	document.getElementById('card_full_info').innerHTML+="card id: " +cardID+"<br />";
	document.getElementById('card_full_info').innerHTML+="card name: " +cName+"<br />";
	document.getElementById('card_full_info').innerHTML+="card finish: " +finish+"<br />";
	document.getElementById('card_full_info').innerHTML += "artist: " + aName + "<br />";
    var urlimg = "<img src=\"resources/generic/uploads/"+cardID+"_lg_preview_static.jpg\" />";
	$(document).ready(function () {
	    $('#mag_s').click(function () {
	        $.blockUI({
	            message: urlimg,
	            css: {
	                top: ($(window).height() - 500) / 2 + 'px',
	                left: ($(window).width() - 500) / 2 + 'px',
	                width: '377px'
	            }
	        });

	        setTimeout($.unblockUI, 4000);
	    });
	    $('.blockOverlay').attr('Card Specifications', 'Click to close').click($.unblockUI);
	}); 

}
function setSelection(which, wborder, whichHidden) {
	if(whichBorder)document.getElementById(whichBorder).style.border = "black 1px dashed";
	
	whichLayer = which;
	whichBorder = wborder;
	whichEdit = whichHidden;
	//alert(whichBorder);
	
	myString = document.getElementById(whichLayer).innerHTML;
	myString = myString.replace(/<BR>/gi,"\n");
	myString = myString.replace(/&amp;/gi,"&");
	myString = myString.replace(/&nbsp;/gi,"");
		
	document.getElementById(whichBorder).style.border = "red 1px dashed";
	document.getElementById('innerTextEditor').value = myString;
	document.getElementById('fontChanger').value = document.getElementById('text_font'+whichHidden).value;
	document.getElementById('colourChanger').value = document.getElementById('text_colour'+whichHidden).value;
	document.getElementById('sizeChanger').value = document.getElementById('text_size'+whichHidden).value;
	document.getElementById('innerTextEditor').focus();
	
	//alert(document.getElementById('text_font'+whichHidden).value);
	//alert(document.getElementById('text_colour'+whichHidden).value);
	//alert(document.getElementById('text_size'+whichHidden).value);
	
	//alert(document.getElementById('fontChanger').value+"-"+document.getElementById('colourChanger').value+"-"+document.getElementById('sizeChanger').value);
}
function changeColour(changeLayer, fontColour, whichEdit) {
	if(changeLayer == null) {
		setSelection('innerLeftEditBoxText','innerLeftEditBox','_0');
		changeLayer = 'innerLeftEditBoxText';
		whichEdit = '_0';
	}
	document.getElementById(changeLayer).style.color = fontColour;
	what = "text_colour"+whichEdit;
	document.getElementById(what).value = fontColour;
}
function changeFont(changeLayer, fontFont, whichEdit) {
	if(changeLayer == null) {
		setSelection('innerLeftEditBoxText','innerLeftEditBox','_0');
		changeLayer = 'innerLeftEditBoxText';
		whichEdit = '_0';
	}
	document.getElementById('text_font'+whichEdit).value = fontFont;
	if(fontFont == "LetterOMatic!") {
		fontFont = "LetterOMatic";
	}
	document.getElementById(changeLayer).style.fontFamily = fontFont;
	//alert(fontFont);
}
function changeSize(changeLayer, myFontSize, whichEdit) {
	if(changeLayer == null) {
		setSelection('innerLeftEditBoxText','innerLeftEditBox','_0');
		changeLayer = 'innerLeftEditBoxText';
		whichEdit = '_0';
	}
	document.getElementById(changeLayer).style.fontSize = myFontSize;
	document.getElementById('text_size'+whichEdit).value = myFontSize;
}
function setHAlign(changeLayer, where, whichEdit) {
	if(changeLayer == null) {
		setSelection('innerLeftEditBoxText','innerLeftEditBox','_0');
		changeLayer = 'innerLeftEditBoxText';
		whichEdit = '_0';
	}
	document.getElementById(changeLayer).style.textAlign = where;
	document.getElementById('text_align'+whichEdit).value = where;
}
function setVAlign(changeLayer, whichEdit, e, pos) {
	var tName = whichLayer+""+whichEdit;
	var x=document.getElementById(tName).rows
	x[e].vAlign=pos;
	if(changeLayer == null) {
		setSelection('innerLeftEditBoxText','innerLeftEditBox','_0');
		changeLayer = 'innerLeftEditBoxText';
		whichEdit = '_0';
	}
	document.getElementById('text_valign'+whichEdit).value = pos;
	//alert(document.getElementById('text_valign'+whichEdit).value);
}
function setUpPageOptions() {
	document.getElementById('innerLeftEditBoxText').style.textAlign = document.getElementById('text_align_0').value;
	document.getElementById('innerLeftEditBoxText_0').rows[0].vAlign = document.getElementById('text_valign_0').value;
	document.getElementById('innerLeftEditBoxText').style.fontSize = document.getElementById('text_size_0').value;
	document.getElementById('innerLeftEditBoxText').style.fontFamily = document.getElementById('text_font_0').value;
	document.getElementById('innerLeftEditBoxText').style.color = document.getElementById('text_colour_0').value;

	document.getElementById('innerRightEditBoxHeaderText').style.textAlign = document.getElementById('text_align_1').value;
	document.getElementById('innerRightEditBoxHeaderText_1').rows[0].vAlign = document.getElementById('text_valign_1').value;
	document.getElementById('innerRightEditBoxHeaderText').style.fontSize = document.getElementById('text_size_1').value;
	document.getElementById('innerRightEditBoxHeaderText').style.fontFamily = document.getElementById('text_font_1').value;
	document.getElementById('innerRightEditBoxHeaderText').style.color = document.getElementById('text_colour_1').value;

	document.getElementById('innerRightEditBoxMainText').style.textAlign = document.getElementById('text_align_2').value;
	document.getElementById('innerRightEditBoxMainText_2').rows[0].vAlign = document.getElementById('text_valign_2').value;
	document.getElementById('innerRightEditBoxMainText').style.fontSize = document.getElementById('text_size_2').value;
	document.getElementById('innerRightEditBoxMainText').style.fontFamily = document.getElementById('text_font_2').value;
	document.getElementById('innerRightEditBoxMainText').style.color = document.getElementById('text_colour_2').value;

	document.getElementById('innerRightEditBoxFooterText').style.textAlign = document.getElementById('text_align_3').value;
	document.getElementById('innerRightEditBoxFooterText_3').rows[0].vAlign = document.getElementById('text_valign_3').value;
	document.getElementById('innerRightEditBoxFooterText').style.fontSize = document.getElementById('text_size_3').value;
	document.getElementById('innerRightEditBoxFooterText').style.fontFamily = document.getElementById('text_font_3').value;
	document.getElementById('innerRightEditBoxFooterText').style.color = document.getElementById('text_colour_3').value;

}
function clearMe() {
	document.getElementById('firstname').value = '';
	document.getElementById('lastname').value = '';
	document.getElementById('add1').value = '';
	document.getElementById('add2').value = '';
	document.getElementById('add3').value = '';
	document.getElementById('town').value = '';
	document.getElementById('county').value = '';
	document.getElementById('postcode').value = '';
	document.getElementById('country').value = '';
	document.getElementById('pid').value = '0';
}
function clearMeU() {
	document.getElementById('add1').value = '';
	document.getElementById('add2').value = '';
	document.getElementById('add3').value = '';
	document.getElementById('town').value = '';
	document.getElementById('county').value = '';
	document.getElementById('postcode').value = '';
	document.getElementById('pid').value = '0';
}
function clearMeUkOnly() {
	document.getElementById('firstname').value = '';
	document.getElementById('lastname').value = '';
	document.getElementById('add1').value = '';
	document.getElementById('add2').value = '';
	document.getElementById('add3').value = '';
	document.getElementById('town').value = '';
	document.getElementById('county').value = '';
	document.getElementById('postcode').value = '';
	document.getElementById('pid').value = '0';
}
function submitform() {
	var day = document.getElementById('day').value;
	var mth = document.getElementById('month').value;
	validateDate(day, mth);
}
function checkSize(s) {
	var sVal = 0;
	for (var i=0; i < document.theForm.cardSize.length; i++) {
		if (document.theForm.cardSize[i].checked) {
			sVal = document.theForm.cardSize[i].value;
			location.href = "cardEdit.aspx?state=cards&mode=edit&cardID="+s+"&sVal="+sVal;
		}
	}
	if(sVal <= 0) alert("Please ensure you have chosen one of the three available card sizes");
}
function checkSizeUpload(s) {
	var sVal = 0;
	for (var i=0; i < document.theForm.cardSize.length; i++) {
		if (document.theForm.cardSize[i].checked) {
			sVal = document.theForm.cardSize[i].value;
			location.href = "uploads.aspx?state=cards&mode=upload&cardID="+s+"&sVal="+sVal;
		}
	}
	if(sVal <= 0) alert("Please ensure you have chosen one of the three available card sizes");
}
function updateDate(e) {
	document.getElementById('avDate').innerHTML = "";
	document.getElementById('delHDate').value = e.value;
}
function updateMe(e,f) {
	document.getElementById(f).value = e.value;
}
function goDelForm() {
	var sVal = 0;
	for (var i=0; i < document.theForm.to.length; i++) {
		if (document.theForm.to[i].checked) {
			sVal = 1;
			document.getElementById('postOptions').submit();
		}
	}
	if(sVal <= 0) alert("Please ensure you have chosen a recipient");
}
function updatePPB() {
	var myNBal = parseFloat(document.getElementById('oBal').value) + parseFloat(document.getElementById('amount').value);
	document.getElementById('nBal').value = myNBal.toFixed(2);
	document.getElementById('pBal').value = parseFloat(document.getElementById('amount').value).toFixed(2);
}
function changeName(whatDetails) {
	var whatName = whatDetails.split("|");
	document.getElementById('contactname').value = whatName[1];
	document.getElementById('contactpid').value = whatName[0];
}
function clearCN() {
	document.getElementById('contactname').value = '';
	document.getElementById('contactpid').value = '0';
}
function swapToInner(theAmt, theList, thisCard) {
	//alert(thisCard);
	var cardnum = thisCard.split("/");
	cardnum = cardnum[cardnum.length-1];
	cardnum = cardnum.split("_");
	cardnum = cardnum[0];
	overImgAr = theList.split(',');
	if(cardnum != "up") {
		for(i=0;i<=theAmt;i++) {
			chk = overImgAr[i].split('|');
			//alert(chk[0] +"=="+ cardnum);
			if(chk[0] == cardnum){
				var imgName = chk[1]+"_preview_static.jpg";
				if(chk[1] == "5") imgName = chk[1]+"_preview_display.jpg";
				document.getElementById('card_placement').src = "resources/generic/uploads/"+imgName;
				prev = cardnum;
			}
		}
	} else {
		prev = "up";
	}
}
function swapToOuter(theAmt, theList) {
	overImgAr = theList.split(',');
	if(prev != null) {
		if(prev != "up") {
			for(i=0;i<theAmt;i++) {
				chk = overImgAr[i].split('|');
				//alert(chk[0] +"=="+ prev);
				if(chk[0] == prev){
					var imgName = chk[0]+"_preview_static.jpg";
					document.getElementById('card_placement').src = "resources/generic/uploads/"+imgName;
				}
			}
		}
	}
}
function reCalcOrder(which, type) {
	amt = document.getElementById(which).value;
	cardID = which;
	if(type == 1) {
		location.href = "cardDelivery.aspx?state=cards&mode=basket&action=reCalc&b_oid="+which+"&amt="+amt;
	} else if(type == 0) {
		location.href = "giftDisplay.aspx?state=cards&mode=basket&action=reCalc&b_oid="+which+"&amt="+amt;
	}
}

function goGiftsDelForm() {
	var sVal = 0;
	for (var i=0; i < document.theForm.to.length; i++) {
		if (document.theForm.to[i].checked) {
			sVal = 1;
			document.getElementById('postOptions').submit();
		}
	}
	if(sVal <= 0) alert("Please ensure you have chosen a recipient");
}

var old_length = 0;
function chkText(where) {
	var new_length = 125 - (where.value.length);
	if(new_length < 0) {
		document.getElementById('text_counter').style.color = "Red";
	}
	document.getElementById('text_counter').innerHTML = new_length;
}

var alert_title='Input Restriction';

function limitTextarea(el,maxLines,maxChar){
	if(!el.x){
		el.x=uniqueInt();
		el.onblur=function(){clearInterval(window['int'+el.x])}
	}
	window['int'+el.x]=setInterval(function(){
		var lines=el.value.replace(/\r/g,'').split('\n'),
		i=lines.length,
		lines_removed,
		char_removed;
		if(maxLines&&i>maxLines){
			alert('You can not enter\nmore than '+maxLines+' lines');
			lines=lines.slice(0,maxLines);
			lines_removed=1
		}
		if(maxChar){
			i=lines.length;
			while(i-->0)if(lines[i].length>maxChar){
				lines[i]=lines[i].slice(0,maxChar);
				char_removed=1
			}
			if(char_removed)alert('You can not enter more\nthan '+maxChar+' characters per line')
		}
		if(char_removed||lines_removed)el.value=lines.join('\n')
	},50);
}

function uniqueInt(){
	var num,maxNum=100000;
	if(!uniqueInt.a||maxNum<=uniqueInt.a.length)uniqueInt.a=[];
	do num=Math.ceil(Math.random()*maxNum);
	while(uniqueInt.a.hasMember(num))
	uniqueInt.a[uniqueInt.a.length]=num;
	return num
}

Array.prototype.hasMember=function(testItem){
	var i=this.length;
	while(i-->0)if(testItem==this[i])return 1;
	return 0
};

function set_ie_alert(){
	window.alert=function(msg_str){
	vb_alert(msg_str)
	}
}

function encodeChars() {
	setTimeout("changeChars(document.getElementById('price').innerHTML)", 10000);
}
function changeChars(e) {
	alert(e);
}
function goPop() {
	window.open('3dsec.htm','3D','width=300,height=400,scrollbars=0');
}
function changeAction(url, d) {
    document.getElementById('cropform').rd.value = d;
    document.getElementById('cropform').action = url;
}
