winCount = 1;
var baseVidURL = '/vrs/userDev/callPage.php';
var opID = '';
var q= '';
var vrsWin = '';
var myLocation = String(document.location);
var isProduction =  ((myLocation.indexOf('rich') == -1)&&(myLocation.indexOf('dave') == -1)&&(myLocation.indexOf('dev') == -1)) ?  true : false;


function popWin(useVideoWindow){
	
	//alert(useVideoWindow);
	
	baseVidURL = isProduction ? '/vrs/user/callPage.php':'/vrs/userDev/callPage.php';
	
	tempString = document.forms['callForm'].theNumber.value;
	tempString = tempString.replace(/\D/g, '');
	myString = tempString.substring(0,3)
	if(myString == '011' && useVideoWindow == 0){
		alert("Were sorry, but i711.com does not support international calls at this time.");
		return false;
	}else{
		if(useVideoWindow == 0){
			// text realy
			winName = 'relay'+winCount;
			document.forms['callForm'].target = winName;
			q = window.open('tmp.html',winName, 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=750,height=450');
			q.opener = self;
			document.forms['callForm'].submit();
			//m = setTimeout("redirectMe()",1000);
			winCount++;		
			return true;
		}else{
			
				// video relay
				//var myLocation = String(document.location);
				//var isProduction =  (myLocation.indexOf('Dev') == -1) ?  true : false;
				if(!vrsWin.closed && vrsWin.location){
					alert("i711 VRS does not allow multiple call windows. Use the 'New Call' button to start a new call in your current window.");
					vrsWin.focus();
				}else{
					
					if(!isProduction){
						//if(getE("cBox").checked)	opID = "opID="+getE("oprID").value
					}
					var myWidgets = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=641,height=411';
					var myURL = baseVidURL + opID;
					var winName = "vrscall";
					//winName = 'relay'+winCount;
					document.forms['callForm'].target = winName;
					document.forms['callForm'].action = myURL;
					//alert(baseVidURL);
					vrsWin = window.open(myURL,winName, myWidgets);
					if (!vrsWin.opener) vrsWin.opener = self;
					document.forms['callForm'].submit();
				}		
			}
	}

}
		function validateCall(theForm,theName){ 
			if(theForm[theName].selectedIndex == -1) return false;
			if(theForm[theName].options[theForm[theName].selectedIndex].value == 'null'){
				return false;
			}else{
				return true;
			}
		}



function openWin(myURL,winName,winW,winH){
	myWidgets = 'toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0,width='+ winW + ',height='+winH;
	var q = window.open(myURL,winName, myWidgets);
	//return true;
}
