// browser detection:
var ua = navigator.userAgent;
var ie = (navigator.appName.toLowerCase().indexOf("internet explorer")!=-1)?1:0;
var ns = (navigator.appName.toLowerCase().indexOf("netscape")!=-1)?1:0;
var ns4 = (document.layers)?1:0;
var ns6 = (document.getElementById && ns)?1:0;
var mac = (navigator.userAgent.toLowerCase().indexOf("mac")!=-1)?1:0;
var macie4 = (mac && !ns && parseInt(ua.substr(ua.indexOf("MSIE")+4,2)) <= 4)?1:0;
var macie = (mac && !ns)?1:0;

function emailAdressIsValid(str){
	var emailAdressFormat = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,3}$/;
	if(str=="")
		{
		return 2
		}
		else if (!(emailAdressFormat.test(str)))
				{
					return 1;
				}
				else
				{				
					return false;
				}
}

function Trim(strToTrim) {
	while(strToTrim.charAt(0)==' '){strToTrim = strToTrim.substring(1,strToTrim.length);}
	while(strToTrim.charAt(strToTrim.length-1)==' '){strToTrim = strToTrim.substring(0,strToTrim.length-1);}
	return strToTrim;
}

function doSubmit(frm){	
	if ((Trim(frm.Name.value) == "")) {alert("Please enter a Name.");frm.Name.focus();return false;}
	else if((Trim(frm.tel.value) == "")){alert("Please enter Phone.");frm.tel.focus();return false;}
	else if (isNaN(parseInt(new Number(frm.tel.value)))) {
			alert("The Telephone field may not contain spaces, non-numeric characters, or dashes.");
			frm.tel.focus();
			return false;
		}
	else if (emailAdressIsValid(frm.Mail.value)==1){alert("Please enter a valid Email.");frm.Mail.focus();return false;}
	else if (emailAdressIsValid(frm.Mail.value)==2){alert("Please enter Email.");frm.Mail.focus();return false;}
	else if((Trim(frm.comments.value) == "")){alert("Please enter comments.");frm.comments.focus();return false;}
	else {return true;}
}

function doSubmit_tr(frm){	
	if ((Trim(frm.Name.value) == "")) {alert("Lütfen isminizi giriniz.");frm.Name.focus();return false;}
	else if((Trim(frm.tel.value) == "")){alert("Telefon numaranız.");frm.tel.focus();return false;}
	else if (isNaN(parseInt(new Number(frm.tel.value)))) {
			alert("Telefon numaranızda boşluk, tire ve buna benzer rakam haricinde karakter kullanmayınız.");
			frm.tel.focus();
			return false;
		}
	else if (emailAdressIsValid(frm.Mail.value)==1){alert("Size ulaşabileceğimiz E-mail adresiniz.");frm.Mail.focus();return false;}
	else if (emailAdressIsValid(frm.Mail.value)==2){alert("E-mailiniz.");frm.Mail.focus();return false;}
	else if((Trim(frm.comments.value) == "")){alert("Yorumlarınızı bekliyoruz.");frm.comments.focus();return false;}
	else {return true;}
}

if (ns4) document.write('<LINK rel="stylesheet" href="stylesn.css" type="text/css">');
else document.write('<LINK rel="stylesheet" href="styles.css" type="text/css">');

// processing the page ID:
pageID = "";
var leftID="";
var arrID = new Array();
arrID = GetIDs(pageID);

// getting the IDs from the page ID:
function GetIDs(whatSplit) {
	var arr1 = whatSplit.split("_");
	var arr2=new Array
	if (arr1.length != 0) {
		arr2[0] = arr1[0];
		for (var i=1; i<arr1.length; i++) {
			arr2[i] = arr2[i-1] + "_" + arr1[i];
		}
		if (arr1.length >= 0) leftID=arr1[2]
	}
	return arr2;
}


//getting the content height:
var contW="100%"
function GetContentH(nr){
	if (ns) {
				contW=parseInt(window.innerWidth-762)
			}
	else
			{
				contW=parseInt((document.body.clientWidth-762))
			}
}

FixNSWindow();
function FixNSWindow() {
	if (ns6 || ns && (parseInt(navigator.appVersion) == 4)) {
		if (typeof document.NS == 'undefined') document.NS = new Object;
		if (typeof document.NS.NS_scaleFont == 'undefined') {
			document.NS.FixCssInNS = new Object;
			document.NS.FixCssInNS.initWindowWidth = window.innerWidth;
			document.NS.FixCssInNS.initWindowHeight = window.innerHeight;
		}
		window.onresize = FixCssInNS;
	}
}
function FixCssInNS() {
	if (document.NS.FixCssInNS.initWindowWidth != window.innerWidth || document.NS.FixCssInNS.initWindowHeight != window.innerHeight) document.location = document.location;
}
ReloadWindow();
function ReloadWindow(){if (!ns) setTimeout("window.onresize=new Function('window.location.reload()')",200);}



var imgNameOff = new Array("images/menu_top_1_off.gif","images/menu_top_2_off.gif","images/menu_top_3_off.gif",
"images/menu_top_1_off_tr.gif","images/menu_top_2_off_tr.gif","images/menu_top_3_off_tr.gif");
var imgNameOn = new Array("images/menu_top_1_on.gif","images/menu_top_2_on.gif","images/menu_top_3_on.gif",
"images/menu_top_1_on_tr.gif","images/menu_top_2_on_tr.gif","images/menu_top_3_on_tr.gif"
);

var imgObjOff = new Array(imgNameOff.length);
var imgObjOn = new Array(imgNameOn.length);
Preload()

//preloading images:
function Preload(){
	for (i = 0; i<imgNameOff.length; i++)
	{
		imgObjOff[i] = new Image();
		imgObjOff[i].src = imgNameOff[i];
		imgObjOn[i] = new Image();
		imgObjOn[i].src = imgNameOn[i];
	}
}
//mouseover fumction:
function swapIn(nume, i)
{
	var o = eval("document." + nume);
	o.src = imgObjOn[i].src;
}
//mouseout fumction:
function swapOut(nume,i)
{
	var o = eval("document." + nume);
	o.src = imgObjOff[i].src;
}
//-->

// prima merge
var newWinImg;
function OpenImage(imgFile){
	if (new String(newWinImg)!="undefined" && newWinImg!=null) if (!newWinImg.closed) newWinImg.close();
	var newWinImg=window.open("","ReservedItemsPicture","width=100,height=100,top=0,left=0,location=no,directories=no,hotkeys=no,copyhistory=no,resizable=no,menubar=no,status=no,toolbar=no,scrollbars=no,z-lock=yes");
	newWinImg.document.write('<HTML><HEAD><TITLE>Sunsel -- Food Stuff</TITLE></HEAD><BODY marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 alink="#0033CC bgcolor="#E5F2FF" onload="window.resizeTo(parseInt(document.images[\'img\'].width)+10,parseInt(document.images[\'img\'].height)+29)"><IMG src="' + imgFile + '" name=img></BODY></HTML>')
	newWinImg.document.close()
	newWinImg.focus();
}

function OpenImage_HC(imgFile){
	if (new String(newWinImg)!="undefined" && newWinImg!=null) if (!newWinImg.closed) newWinImg.close();
	var newWinImg=window.open("","ReservedItemsPicture","width=100,height=100,top=0,left=0,location=no,directories=no,hotkeys=no,copyhistory=no,resizable=no,menubar=no,status=no,toolbar=no,scrollbars=no,z-lock=yes");
	newWinImg.document.write('<HTML><HEAD><TITLE>Sunsel -- Home Concept</TITLE></HEAD><BODY marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 alink="#0033CC bgcolor="#E5F2FF" onload="window.resizeTo(parseInt(document.images[\'img\'].width)+10,parseInt(document.images[\'img\'].height)+29)"><IMG src="' + imgFile + '" name=img></BODY></HTML>')
	newWinImg.document.close()
	newWinImg.focus();
}

