



//
isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
	topDog=isIE ? "BODY" : "HTML";
	whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");
	hotDog=isIE ? event.srcElement : e.target;
	while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
		hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
	}
	if (hotDog.id=="titleBar"){
		offsetx=isIE ? event.clientX : e.clientX;
		offsety=isIE ? event.clientY : e.clientY;
		nowX=parseInt(whichDog.style.left);
		nowY=parseInt(whichDog.style.top);
		ddEnabled=true;
		document.onmousemove=dd;
	}
}

function dd(e){
	if (!ddEnabled) return;
	whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
	whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
	return false;
}

function ddN4(whatDog){
	if (!isN4) return;
	N4=eval(whatDog);
	N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
	N4.onmousedown=function(e){
		N4.captureEvents(Event.MOUSEMOVE);
		N4x=e.x;
		N4y=e.y;
	}
	N4.onmousemove=function(e){
		if (isHot){
			N4.moveBy(e.x-N4x,e.y-N4y);
			return false;
		}
	}
	N4.onmouseup=function(){
		N4.releaseEvents(Event.MOUSEMOVE);
	}
}

function hideMe(){
	if (isIE||isNN) whichDog.style.visibility="hidden";
	else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
	if (isIE||isNN) whichDog.style.visibility="visible";
	else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");



//
function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
}//clear text
//
//pop3.php add to basket
function updateParent(newURL) {
	opener.document.location = newURL

}

//windowu ortaliyorum
dom = (document.getElementById) ? true : false;

ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;

ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;

ns4 = (document.layers && !dom) ? true : false;

ie4 = (document.all && !dom) ? true : false;

nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

//

//detect browser

isNS4 = (document.layers) ? true : false;

isIE4 = (document.all && !document.getElementById) ? true : false;

isIE5 = (document.all && document.getElementById) ? true : false;

isNS6 = (!document.all && document.getElementById) ? true : false;

//

//window acmak icin kullaniyorum tam ortaya

function openWin(name,wid,hei,sbar,title){

	xx=screen.availWidth/2-wid/2;

	yy=screen.availHeight/2-hei/2;

	str="left=" + Math.round(xx) + ",top=" + Math.round(yy);



	window.open(name,title,'width='+wid+',height='+hei+',toolbar=no,scrollbars='+sbar+',resizable='+sbar+','+str);

}



function window_c(){

	window.close()

}

//---Window netscape e gore resize ediyorum

function MM_reloadPage(init) {  //reloads the window if Nav4 resized

	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {

		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}

		else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();

}

MM_reloadPage(true);

//burasi image icin ustune geldiginde degisecek
function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function WM_imageSwap(daImage, daSrc){
	var objStr,obj;

	if(document.images){
		// Check to see whether you are using a name, number, or object
		if (typeof(daImage) == 'string') {
			// This whole objStr nonesense is here solely to gain compatability
			// with ie3 for the mac.
			objStr = 'document.' + daImage;
			obj = eval(objStr);
			obj.src = daSrc;
		} else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
			daImage.src = daSrc;
		}
	}
}

















function checkrequired(which) {
	var pass=true;
	if (document.images) {


		for (i=0;i<which.length;i++) {
			var tempobj=which.elements[i];
			if (tempobj.name.substring(0,8)=="required") {
				//---added
				if (tempobj.defaultValue==tempobj.value)
				tempobj.value = ""
				//


				if (((tempobj.type=="text"||tempobj.type=="textarea")&&
				tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
				tempobj.selectedIndex==0)) {
					pass=false;
					break;
				}
			}
		}
	}
	if (!pass) {
		shortFieldName=tempobj.name.substring(8,30).toUpperCase();
		alert("Please make sure the "+shortFieldName+" field was properly completed.");
		return false;
	}
	else
	return true;
}//end of function



//

function start(){

	x=document.startform
	at=x.remail.value.indexOf("@")

	submitOK="True"
	if (at==-1){
		alert("Not a valid e-mail. This is important for your order");
		return false;
	}


	if (submitOK=="False"){
		return false
	}
} //end of function


//newPayment
function exist()
{
	x=document.formPayment;

	//required
	shaddress1=x.sh_address1.value;
	shcity=x.sh_city.value;
	shstate=x.sh_state.value;
	shzip=x.sh_zip.value;
	shphone=x.sh_phone.value;

	var inf = window.document.formPayment.cc_information.checked;
	var ds_inf = window.document.formPayment.ds_information.checked;

	ccaddress1=x.cc_address1.value;
	cccity=x.cc_city.value;
	ccstate=x.cc_state.value;
	cczip=x.cc_zip.value;

	ds_name=x.ds_name.value;
	ds_address1=x.ds_address1.value;
	ds_city=x.ds_city.value;
	ds_state=x.ds_state.value;
	ds_zip=x.ds_zip.value;

	submitOK="True";

	if (shaddress1 == ''){
		alert("Error: Address");
		return false;
	}else{
		if (shcity == ''){
			alert("Error: City");
			submitOK="False";
		}else{
			if (shstate.length != 2){
				alert("Error: State");
				submitOK="False";
			}else{
				if (shzip.length != 5){
					alert("Error: Zip");
					submitOK="False";
				}else{
					if (shphone.length < 10){
						alert("Error: Please enter your (***-***-****) 10 digits Phone Number");
						submitOK="False";
					}else{
						if (inf == false){
							if (ccaddress1 == ''){
								alert("Error: Billing Address")
								submitOK="False"
							}else{
								if (cccity == ''){
									alert("Error: Billing City")
									submitOK="False"
								}else{
									if (ccstate.length != 2){
										alert("Error: Billing State")
										submitOK="False"
									}else{
										if (cczip.length != 5){
											alert("Error: Billing Zip")
											submitOK="False"
										}//cczip
										else
										{
											if (ds_name == ''){
												alert("Error: Drop Ship Name")
												submitOK="False"
											}else{
												if (ds_inf == false){
													if (ds_address1 == ''){
														alert("Error: Drop Ship Address")
														submitOK="False"
													}else{
														if (ds_city == ''){
															alert("Error: Drop Ship City")
															submitOK="False"
														}else{
															if (ds_state.length != 2){
																alert("Error: Drop Ship State")
																submitOK="False"
															}else{
																if (ds_zip.length != 5){
																	alert("Error: Drop Ship Zip")
																	submitOK="False"
																}//cczip

															}//ccstate

														}//cccity

													}//ccaddress1
												}//end of inf
											}
										}
									}//ccstate

								}//cccity

							}//ccaddress1
						}//end of inf
					}//end of phone
				}//end of zip
			}//end of state
		}//end of city
	}//end of address1

	if (submitOK=="False")
	{
		return false;
	}



}//end of exist function















function newClient(){


	x=document.formPayment;

	clname=x.cl_name.value;
	cllast=x.cl_last.value;
	clpassword=x.cl_password.value;
	clpassword2=x.cl_password2.value;

	//required
	shaddress1=x.sh_address1.value;
	shcity=x.sh_city.value;
	shstate=x.sh_state.value;
	shzip=x.sh_zip.value;
	shphone=x.sh_phone.value;

	var inf = window.document.formPayment.cc_information.checked;


	ccaddress1=x.cc_address1.value;

	cccity=x.cc_city.value;
	ccstate=x.cc_state.value;
	cczip=x.cc_zip.value;






	submitOK="True";

	if (clname == ''){
		alert("Error: First Name");
		submitOK="False";
	}else{
		if (cllast == ''){
			alert("Error: Last Name");
			submitOK="False";
		}else{
			if(clpassword== ''){
				alert("Error Password");
				submitOK="False";
			}else{
				if(clpassword != clpassword2){
					alert("Error: Please confirm the password");
					submitOK="False";
				}else{
					if (shaddress1 == ''){
						alert("Error: Address");
						submitOK="False";
					}else{
						if (shcity == ''){
							alert("Error: City");
							submitOK="False";
						}else{
							if (shstate.length != 2){
								alert("Error: State");
								submitOK="False";
							}else{
								if (shzip.length != 5){
									alert("Error: Zip");
									submitOK="False";
								}else{
									if (shphone.length < 10){
										alert("Error: Please enter your (***-***-****) 10 digits Phone Number");
										submitOK="False";
									}else{
										if (inf == false){
											if (ccaddress1 == ''){
												alert("Error: Billing Address")
												submitOK="False"
											}else{
												if (cccity == ''){
													alert("Error: Billing City")
													submitOK="False"
												}else{
													if (ccstate.length != 2){
														alert("Error: Billing State")
														submitOK="False"
													}else{
														if (cczip.length != 5){
															alert("Error: Billing Zip")
															submitOK="False"
														}//else{
														//submitOK="False"
														//alert("Error: Test Alert")
														//}

													}//ccstate

												}//cccity

											}//ccaddress1
										}//end of inf






									}//end of phone

								}//end of zip
							}//end of state
						}//end of city
					}//end of address1
				}//pswrd
			}//pswrd check
		}//lastname
	}//firstname

	if (submitOK=="False")
	{
		return false;
	}



}//end of new function

//









function payment()
{
	x=document.paymentForm;
	cctype=x.cc_type.value
	ccname=x.cc_name.value
	ccnumber=x.cc_number.value
	ccmonth=x.cc_month.value
	ccyear=x.cc_year.value
	cccww=x.cc_cww.value

	submitOK="True"


	if(ccnumber==''){
		alert("Error: Please Check the "+cctype+" number")
		submitOK="False"
	}else{
		if(ccname == ''){
			alert("Error: Please Write The Card Holders Name ")
			submitOK="False"
		}else{
			if(cccww == ''){
				alert("Error: Please Enter the CVV2 Code")
				submitOK="False"
			}

		}//end of ccname
	}//end of cc

	if (submitOK=="False"){
		return false;
	}//end of if
} //end of function

//













//customer service teki formu yonetiyor
function customer()
{
	x=document.formCustomer

	at=x.cl_email.value.indexOf("@")
	clname=x.cl_name.value
	cllast=x.cl_last.value
	clcomment=x.cl_comment.value



	submitOK="True"
	if (at==-1){
		alert("Not a valid e-mail");
		return false;
	}else{
		if (clname == ''){
			alert("Error: First Name");
			return false;
		}else{
			if (cllast == ''){
				alert("Error: Last Name");
				return false;
			}else{
				if (clcomment == ''){
					alert("Error: What is the problem?");
					return false;
				}
			}
		}
	}

	if (submitOK=="False")
	{
		return false
	}
} //end of function

//












//account sign in icin
function signin()
{
	x=document.forsignin

	at=x.thisEmail.value.indexOf("@")
	password=x.thisPassword.value




	submitOK="True"
	if (at==-1){
		alert("Not a valid e-mail address");
		return false;
	}else{
		if (password == ''){
			alert("Error: Please enter your password");
			return false;
		}
	}

	if (submitOK=="False")
	{
		return false
	}
} //end of function

//

//Register icin
function register()
{
	x=document.formregister

	at=x.cl_email.value.indexOf("@")
	clname=x.cl_name.value
	cllast=x.cl_last.value
	clpassword=x.cl_password.value
	clpassword2=x.cl_password2.value



	submitOK="True"
	if (at==-1){
		alert("Not a valid e-mail");
		return false;
	}else{
		if (clname == ''){
			alert("Error: First Name");
			return false;
		}else{
			if (cllast == ''){
				alert("Error: Last Name");
				return false;
			}else{
				if (clpassword == ''){
					alert("Please enter a password");
					return false;
				}else{
					if (clpassword != clpassword2){
						alert("Please confirm the password");
						return false;
					}//end cl pswrd
				}//cl-pswrd
			}
		}
	}
	if (submitOK=="False")
	{
		return false
	}
} //end of function


