browserType=navigator.appName.charAt(0)+navigator.appVersion.charAt(0);
var miscWindow,offsiteWin,kanjiWindow,disWindow;
var myName,myURL,myWidth,myHeight;

//*****************************

function protectImages(e) {
	if (navigator.appName == 'Netscape' &&
		(e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' &&(event.button == 2 || event.button == 3)) {
		alert("2004-2009 Studio-Ryu, LLC.");
		return false;
	}
	return true;
} 
 /* 
document.onmousedown=protectImages;
document.onmouseup=protectImages;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=protectImages;
window.onmouseup=protectImages;
*/


//*****************************
function noNewFrames(){
	if(parent.location.href != window.location.href){		
		parent.location.href != window.location.href
	}

}

//*****************************
function openWindow(myURL,myName,myWidth,myHeight){
	if(screen){

		leftPos = screen.width/2-(myWidth/2);
		topPos = screen.height/2-(myHeight/2);

	}

	if (browserType=="N2"){
		miscWindow=window.open("",myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
		miscWindow.opener=myURL;
	}else if (browserType.charAt(0)=="M"){
		miscWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
	}else{
		miscWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
	}
		setTimeout("miscWindow.focus();",200);
}
//*****************************

function announce(myURL,myName,myWidth,myHeight){

	if(screen){

		leftPos = screen.width/2-(myWidth/2);
		topPos = screen.height/2-(myHeight/2);
		//leftPos = screen.width-(myWidth);
		//topPos = screen.height-(myHeight);


	}


	if (browserType=="N2"){
		miscWindow=window.open("",myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
		miscWindow.opener=myURL;
	}else if (browserType.charAt(0)=="M"){
		miscWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
	}else{
		miscWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
	}
		setTimeout("miscWindow.focus();",200);
}

//*****************************

function standardWindow(myURL,myName,myWidth,myHeight){

	if(screen){

		leftPos = screen.width/2-(myWidth/2);
		topPos = screen.height/2-(myHeight/2);

	}

	if (browserType=="N2"){
		miscWindow=window.open("",myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,locationbar=1,toolbar=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
		miscWindow.opener=myURL;
	}else if (browserType.charAt(0)=="M"){
		miscWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,locationbar=1,toolbar=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
	}else{
		miscWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,locationbar=1,toolbar=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,left="+leftPos+",top="+topPos);
		miscWindow.opener=self;
	}
		setTimeout("miscWindow.focus();",200);
}

//*****************************

function displayWindow(myURL,myName,myWidth,myHeight){

	if(screen){

		leftPos = screen.width/2-(myWidth/2);
		topPos = screen.height/2-(myHeight/2);

	}

	if (browserType=="N2"){
		disWindow=window.open("",myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left="+leftPos+",top="+topPos);
		disWindow.opener=self;
		disWindow.opener=myURL;
	}else if (browserType.charAt(0)=="M"){
		disWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left="+leftPos+",top="+topPos);
		disWindow.opener=self;
	}else{
		disWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left="+leftPos+",top="+topPos);
		disWindow.opener=self;
	}

	setTimeout("disWindow.focus();",200);
}


//*****************************

function loginWindow(myURL,myName,myWidth,myHeight){

	if(screen){

		leftPos = screen.width/2-(myWidth/2);
		topPos = screen.height/2-(myHeight/2);

	}

	if (browserType=="N2"){
		logWindow=window.open("",myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,left="+leftPos+",top="+topPos);
		logWindow.opener=self;
		logWindow.opener=myURL;
	}else if (browserType.charAt(0)=="M"){
		logWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,left="+leftPos+",top="+topPos);
		logWindow.opener=self;
	}else{
		logWindow=window.open(myURL,myName,"width="+myWidth+",height="+myHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,left="+leftPos+",top="+topPos);
		logWindow.opener=self;
	}

setTimeout("logWindow.focus();",200);

}

//*****************************

function closeWindow(){

	if(miscWindow && !miscWindow.closed){
		miscWindow.close();
	}
}

//******************************
/*------------------------
DATE: 11-14-01
SCRIPT: checkForm
SCRIPT MODIFICATION: Rudy Rogers > rudy@studioryu.com
SCRIPT BIO: checks if all elemints in a form are valid values
REFERENCE SOURCE: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library)
-------------------------*/
function checkForm(formName){

	//initialize variables
	var x = 0;
	var formOk = true;
	var alertMessage = "";

	var emailOk = true;
	var temp = document.forms[formName].email;
	var atSym = temp.value.indexOf('@');
	var period = temp.value.lastIndexOf('.');
	var space = temp.value.indexOf(' ');
	var endChar = ((temp.value.length-1) - temp.value.indexOf('.'));

	//array is from 0 to length -1
	var length = temp.value.length -1;
	var domainEx = new Array("com","net","biz","info","org","gov","edu","tv","int","mil","gov","arpa","aero","name","coop","pro","museum","cc","ws","ca","de","jp","ro","be","fm","ms","tc","ph","co","il","dk","st","ac","gs","vu","vg","sh","kz","as","lt","to");
	var domainEx2 = new Array("o.uk","o.za","o.nz","m.ro","t.nz","g.uk","g.nz","m.ph","g.il");
//--------------

	//if the form's password value is not equal to the confrim value...
	if(document.forms[formName].password.value != document.forms[formName].confirmPass.value){

		//prompt user
		alert('Please check password and confirmation.');
		//go back to that form field
		document.forms[formName].Password.focus();
	}

//--------------

	//if the '@' is the first item or the '.' is in the same place or at the end of array
	//or there are spaces...
	if((atSym < 1) || (period <= atSym+1) || (period == length) || (space != -1)){
		
		//return false
		emailOk = false;
		messageDisplay("This is not a valid email address!\nPlease check for typos.");
	}

	//while x is less than the amount of the form element and formOk is true...
	while((x < document.forms[formName].elements.length) && (formOk)){

		//if this forms element's value equals blank or 'default'...
		if(document.forms[formName].elements[x].value == ''|| document.forms[formName].elements[x].value == 'default' ){
			
			if(document.forms[formName].elements[x].name == 'fname'){
				document.forms[formName].elements[x].name = 'First Name';

			}
			if(document.forms[formName].elements[x].name == 'lname'){
				document.forms[formName].elements[x].name = 'Last Name';

			}
			if(document.forms[formName].elements[x].name == 'username'){
				document.forms[formName].elements[x].name = 'Username';

			}
			if(document.forms[formName].elements[x].name == 'password'){
				document.forms[formName].elements[x].name = 'Password';

			}



			//promt user
			alert('Please fill in your '+document.forms[formName].elements[x].name +' and try again.');
			//go back to that form field
			document.forms[formName].elements[x].focus();
			//return false
			formOk = false;
		}

		//increment x
		x++;
	}
	
	var i = period+1;
	var x = length;
	var y = 0;
	var periodNum = 0;
	var ext = "";
	var ext2 = "";
	
	if(period != length){

	emailOk = false;
	
	do{
		ext += temp.value.charAt(i);
		ext2 += temp.value.charAt(i -2)
		i++;		
		x--;
	
	}while(x!=0);
	
	for(i=0;i<domainEx.length;i++){
		if(!emailOk){
			if(ext == domainEx[i]){
				emailOk = true;
			}
		}
	}
	
	for(i=0;i<domainEx2.length;i++){
		if(!emailOk){
			if(ext2 == domainEx2[i]){
				emailOk = true;
			}
		}
	}

	if(emailOk == false){
			messageDisplay("This is not a valid email address!\nPlease check your domain extention.\n\""+ext+"\" is not a valid extention. ");
	}
	

	}

//-----------------	

function messageDisplay(alertMessage){
		//prompt user
		alert(alertMessage);
		//go back to that form field
		temp.focus();

}
//--------------


	return formOk;
	return emailOk;

}
