function deleteDealPrompt(id,name,formId){var answer=confirm("Are you sure you want to delete "+name+"?");if(answer){SubmitForm(formId);}}
function insertAtCursor(myField,myValue){var doc=document;if(doc.selection){myField.focus();sel=doc.selection.createRange();sel.text=myValue;}else if(myField.selectionStart||myField.selectionStart=='0'){var startPos=myField.selectionStart;var endPos=myField.selectionEnd;myField.value=myField.value.substring(0,startPos)+myValue+myField.value.substring(endPos,myField.value.length);}else{myField.value+=myValue;}}
var doc=document;function isArray(a){return Object.prototype.toString.apply(a)==='[object Array]';}
function Toggle(prefix,obj){var doc=document;for(i=1;i<=doc.getElementById(prefix+'_Links').childNodes.length;i++){var el=doc.getElementById(prefix+'_Table_'+i);if(prefix+'_Tab_'+i==obj.id){el.style.display='block';el.className='Add_Table_Active';}
else{el.style.display='none';el.className='';}}}
function AddrBook(){var doc=document;if(doc.getElementById('To').style.display=='none'){doc.getElementById('To').style.display='block';doc.getElementById('AddrBook').style.display='none';doc.getElementById('AddrBookTog').innerHTML='Address Book';}
else{doc.getElementById('To').style.display='none';doc.getElementById('AddrBook').style.display='block';doc.getElementById('AddrBookTog').innerHTML='Address';}}
function OpenClose(id){var el=document.getElementById(id);if(el.style.display=='block'){el.setAttribute('style','display:none;');}
else{el.setAttribute('style','display:block;');}}
function OpenCloseHelp(obj,id){var el=document.getElementById(id);if(el.style.display=='block'){el.setAttribute('style','display:none;');document.getElementById(obj.id).className='HelpOpen';}
else{el.setAttribute('style','display:block;');document.getElementById(obj.id).className='HelpClose';}}
function AvControl(buttonid,id){var doc=document;var el=doc.getElementById(id);if(el.style.display=='block'){doc.getElementById(buttonid).innerHTML='change';doc.getElementById(buttonid+'_L').setAttribute('style','display:block');el.setAttribute('style','display:none;');}
else{doc.getElementById(buttonid).innerHTML='cancel';doc.getElementById(buttonid+'_L').setAttribute('style','display:none');el.setAttribute('style','display:block;');}}
function Flag(id){if(document.getElementById(id).style.display=='none'){document.getElementById(id).style.display='block';document.getElementById('Com_'+id).style.display='none';}
else{document.getElementById(id).style.display='none'
document.getElementById('Com_'+id).style.display='block';}}
function AddInlineCheck(id){var doc=document;doc.getElementById(id).setAttribute("onmousemove","InlineCheck(id);");doc.getElementById(id).setAttribute("onblur","InlineCheck(id);");}
function RemoveInlineCheck(id){document.getElementById(id).removeAttribute("onmousemove");}
function InlineCheck(id){val=document.getElementById(id).value;switch(id){case"user_name":CheckUserName(val);break;case"email":CheckEmail(val);break;case"captcha_code":CheckCaptcha(val);break;case"pass":CheckPass(val,'passMSG');break;case"Confirm_Pass":CheckPass(val,'Confirm_PassMSG');break;case"country":CheckCountry(val);break;}}
function CheckUserName(val){inlineMSG=document.getElementById('user_nameMSG');if(val!=''){if(val.search(/^[A-Za-z0-9]{1}[A-Za-z_0-9]{4,14}$/)!=-1){inlineMSG.style.display='block';inlineMSG.setAttribute('class','MSGList Check');document.getElementById('SubmitLogin').style.display='inline';document.getElementById('userunlength').style.color='';document.getElementById('userunderscore').style.color='';document.getElementById('userunchars').style.color='';document.getElementById('userunlength').style.display='none';document.getElementById('userunderscore').style.display='none';document.getElementById('userunchars').style.display='none';document.getElementById('user_nameMSGTitle').style.display='none';}
else{if(val.length<5){document.getElementById('userunlength').style.color='#FF0000';}
if(val.search(/^(_)[A-Za-z_0-9]*$/)!=-1){document.getElementById('userunderscore').style.color='#FF0000';}
if(val.search(/^[A-Za-z0-9_]+$/)==-1){document.getElementById('userunchars').style.color='#FF0000';}
inlineMSG.style.display='block';inlineMSG.setAttribute('class','MSGList X');document.getElementById('SubmitLogin').style.display='none';}}}
function CheckPass(val,MSG){inlineMSG=document.getElementById(MSG);if(val!=''){if(val.search(/^[A-Za-z0-9_!?]{5,15}$/)!=-1){inlineMSG.style.display='block';inlineMSG.innerHTML='';inlineMSG.setAttribute('class','MSGList Check');document.getElementById('SubmitLogin').style.display='inline';document.getElementById('passunlength').style.color='';document.getElementById('passunchars').style.color='';document.getElementById('passMSGTitle').style.display='none';document.getElementById('passunlength').style.display='none';document.getElementById('passunchars').style.display='none';}
else{if(val.length<5){document.getElementById('passunlength').style.color='#FF0000';}
if(val.search(/^[A-Za-z0-9_!?]+$/)==-1){document.getElementById('passunchars').style.color='#FF0000';}
inlineMSG.style.display='block';inlineMSG.setAttribute('class','MSGList X');document.getElementById('SubmitLogin').style.display='none';}}}
function CheckEmail(val){inlineMSG=document.getElementById('emailMSG');if(val!=''){if(val.search(/^[a-z0-9._%-]+@[a-z0-9.-]+\.[a-z]{2,4}$/)!=-1){inlineMSG.style.display='block';inlineMSG.innerHTML='';inlineMSG.setAttribute('class','MSGList Check');document.getElementById('SubmitLogin').style.display='inline';}
else{inlineMSG.style.display='block';inlineMSG.setAttribute('class','MSGList X');document.getElementById('SubmitLogin').style.display='none';}}}
function addEvent(){var doc=document;if(doc.getElementById('InputListName')){var InputListName=doc.getElementById('InputListName');InputListName.setAttribute("onblur","replaceInput(this,'InputListName'); CloseEditListName('ListForm','ListName','EditListName')");InputListName.setAttribute("onfocus","clearInput(this,'InputListName');");}
if(doc.getElementById('ListEditLink')){doc.getElementById('ListEditLink').setAttribute('href','javascript:void(0)');}
if(doc.getElementById('ListName')){var listname=doc.getElementById('ListName');listname.setAttribute("onclick","EditListName('ListName','EditListName');");}
if(doc.getElementById('SaveClose')){var SaveClose=doc.getElementById('SaveClose');SaveClose.setAttribute("onclick","CloseEditListName('ListForm','ListName','EditListName');");}}
function ShowButton(){if(document.getElementById('CloseButton')){x=document.getElementById('CloseButton');x.className=x.className.replace("Hide","Show");}}
function CloseMessage(){if(document.getElementById("MessageCenter")!=null){document.getElementById("MessageCenter").style.display="none";}}
function TimedCloseMessage(){if(document.getElementById("MessageCenter")!=null){setTimeout('document.getElementById("MessageCenter").style.display = "none"',15000);}}
function ReturnPath(Path){setTimeout("location.href=Path",500);}
function getHTTPObject(){var xmlhttp=false;if(typeof ActiveXObject!='undefined'){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(E){xmlhttp=false;}}}
else if(XMLHttpRequest){try{xmlhttp=new XMLHttpRequest();}
catch(e){xmlhttp=false;}}
return xmlhttp;}
var clearInputValue=Array();function clearInput(thisObj,id){if(!clearInputValue[thisObj]){document.getElementById(id).style.color="#333333";clearInputValue[thisObj]=thisObj.value;thisObj.value="";}}
function replaceInput(thisObj,id){if(thisObj.value==""){document.getElementById(id).style.color="";thisObj.value=clearInputValue[thisObj];clearInputValue[thisObj]=false;}}
function toggleMenu(menu1Id,menu2Id){var menu1=document.getElementById(menu1Id);var menu2=document.getElementById(menu2Id);if(menu2.style.display=='block'){menu1.setAttribute('style','display:block;');menu2.setAttribute('style','display:none;');}else{menu1.setAttribute('style','display:none;');menu2.setAttribute('style','display:block;');}}
function MarkRead(id){var doc=document;var xmlhttp=getHTTPObject();if(xmlhttp){var url="http://bargaincrew.com/General/MarkRead.php";xmlhttp.open("POST",url,true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){doc.getElementById('Mark_'+id).setAttribute('style','display:none;');}
else if(xmlhttp.readyState==4&&xmlhttp.status==200){doc.getElementById('Comment_'+id).setAttribute('style','display:none;');}}
xmlhttp.send('markread='+id);}}
var http={xmlhttp:false,httpObject:function(){if(typeof ActiveXObject!='undefined'){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){this.xmlhttp=false;}}}else if(XMLHttpRequest){try{this.xmlhttp=new XMLHttpRequest();}catch(e){this.xmlhttp=false;}}
return this.xmlhttp;},httpSend:function(id,data,url,key){var obj=this.httpObject();var doc=document;if(obj){obj.open("POST",url,true);obj.setRequestHeader("Content-type","application/x-www-form-urlencoded");obj.setRequestHeader("Content-length",data);obj.setRequestHeader("Connection","close");obj.onreadystatechange=function(){if(obj.readyState==4){doc.getElementById(id).innerHTML=obj.responseText;}}
obj.send(key+'='+data);doc.getElementById(id).innerHTML='<object width="20" height="20">'
+'<param name="movie" value="Images/loading.swf">'
+'<embed src="Images/loading.swf" width="20" height="20">'
+'</embed>'
+'</object>';}else{doc.getElementById(id).innerHTML='No httpObject';}}}
var toggle={
	doc:document,
	tog:function(in1,in2){
		if(this.doc.getElementById(in1).style.display=='none'){
			this.set(in1,'block');
			in2!=null?this.set(in2,'none'):'';
		} else{
			this.set(in1,'none');
			in2!=null?this.set(in2,'block'):'';
		}
	},
	multi:function(in1,in2){
		if(this.doc.getElementById(in1[0]).style.display=='none'){
			this.set(in1,'block');
			in2!=null?this.set(in2,'none'):'';
		}else{
			this.set(in1,'none');
			in2!=null?this.set(in2,'block'):'';
		}
	},
	single:function(id,array){
		if(isArray(array)){
			for(i=array.length-1;i>=0;i--){
				var el=this.doc.getElementById(array[i]);
				array[i]==id?el.setAttribute('style','display:block;'):el.setAttribute('style','display:none;');
			}
		}
	},
	set:function(input,dispType){
		if(isArray(input)){
			for(i=1-1;i<input.length;i++){
				this.doc.getElementById(input[i]).setAttribute('style','display:'+dispType+';');
			}
		}else{
			this.doc.getElementById(input).setAttribute('style','display:'+dispType+';');
		}
	},
	giveFoc:function(id){
		this.doc.getElementById(id).focus();
	},
	togButtons:function(id,array,butClass){
		var butClass=butClass==null?'active':butClass;
		if(isArray(array)){
			for(i=array.length-1;i>=0;i--){
				var el=this.doc.getElementById(array[i]);
				array[i]==id?el.setAttribute('class',butClass):el.removeAttribute('class');
			}
		}
	}
}
function copyValue(from,to){doc.getElementById(to).innerHTML=doc.getElementById(from).value;}
var selectMailTo={doc:document,modify:function(menuId,toId,comma){var menuObj=this.doc.getElementById(menuId);if(menuObj.type=='checkbox'){if(menuObj.checked==1){$(menuObj).parent().addClass('mailInput-active');var value=$('#'+toId).val()==''?$(menuObj).val():$('#'+toId).val()+",\n"+$(menuObj).val();if(this.checkForValue($(menuObj).val(),toId)==false){$('#'+toId).val(value);}}else{$(menuObj).parent().removeClass('mailInput-active');var value=$('#'+toId).val();this.checkForValue(",\n"+$(menuObj).val(),toId)==true?$('#'+toId).val(value.replace(',\n'+$(menuObj).val(),'')):$('#'+toId).val(value.replace($(menuObj).val(),'').substr(2));}}else if(menuObj.type=='select-one'){var value=$('#'+toId).val()+"\n\n"+menuObj.value.replace("{n}","\n");if(this.checkForValue($(menuObj).val(),toId)==false){$('#'+toId).val(value);}}else{var value=$('#'+toId).val()==''?$(menuObj).val():$('#'+toId).val()+",\n"+$(menuObj).val();if(this.checkForValue($(menuObj).val(),toId)==false){$('#'+toId).val(value);}}},checkForValue:function(val,toId){var toVal=$('#'+toId).val();return(toVal.indexOf(val)>=0);}}
var searchReplace={doc:document,searchTxt:function(needle,rep,haystack,repNl){for(var i=1;this.srch(haystack,needle)!=-1;i++){if(i==200){break;}
this.doc.getElementById(haystack).value=(this.doc.getElementById(haystack).value.replace(this.doc.getElementById(needle).value,this.doc.getElementById(rep).value));}
if(this.doc.getElementById(repNl).checked==1){for(var i=1;this.srch(haystack,"\n")!=-1;i++){if(i==200){break;}
this.doc.getElementById(haystack).value=this.doc.getElementById(haystack).value.replace("\n",'');}}},addId:function(id,srch,rpl,value,repNl){document.getElementById(id).setAttribute('onSubmit',"searchReplace.searchTxt('"+srch+"', '"+rpl+"', '"+value+"', '"+repNl+"')");},srch:function(hay,ndl){return ndl=="\n"?this.doc.getElementById(hay).value.search("\n"):this.doc.getElementById(hay).value.search(this.doc.getElementById(ndl).value);}}