function checkmember(pleasefill,name,phone)
{
	var err=pleasefill+":\n";
	if (document.all.Fname.value == "")
	{
		err=err+name+"\n";
	}
	
//	if (document.all.Lname.value == "")
//	{
//		err=err+lname+"\n";
//	}
	
//	if (document.all.school1.value == "")
//	{
//		err=err+school+"\n";
//	}else{
//		if (document.all.school1.value == 37)
//		{
//			if (document.all.ather_school.value == "")
//		{
//			err=err+school+"\n";
//			}
//			if (document.all.ather_city.value == "")
//			{
//				err=err+city+" "+school+"\n";
//			}
//		}
//	}
	
//	if (document.all.school_start1.value == "")
//	{
//		err=err+sstart+"\n";
//	}else{
//		stringLength=document.all.school_start1.value.length;
//		if ((stringLength!=4) || (isNaN(document.all.school_start1.value)))
//		{
//			err=err+sstart+"\n";
//		}
//	}
//	if (document.all.school_end1.value == "")
//	{
//		err=err+send+"\n";
//	}else{
//		stringLength=document.all.school_end1.value.length;
//		if ((stringLength!=4) || (isNaN(document.all.school_end1.value)))
//		{
//			err=err+send+"\n";
//		}
//	}
	
//	if (document.all.school_start2.value != "")
//	{
//		stringLength=document.all.school_start2.value.length;
//		if ((stringLength!=4) || (isNaN(document.all.school_start2.value)))
//		{
//			err=err+sstart+"\n";
//		}
//	}
//	if (document.all.school_end2.value != "")
//	{	
//		stringLength=document.all.school_end2.value.length;
//		if ((stringLength!=4) || (isNaN(document.all.school_end2.value)))
//		{
//			err=err+send+"\n";
//		}
//	}
	
//	if (document.all.city.value == "")
//	{
//		err=err+city+"\n";
//	}
	
	if (document.all.phone1 == "")
	{
		err=err+phone+"\n";
	}
	
	if (err!=pleasefill+":\n")
	{
		alert(err);
		return false;
	}else{
		return true
	}
}

function checkmemberfamily(pleasefill,name,lname,address,email,phone,or)
{
	
	var err=pleasefill+":\n";
	if (document.all.Fname.value == "")
	{
		err=err+name+"\n";
	}
	
	if (document.all.Lname.value == "")
	{
		err=err+lname+"\n";
	}	
	
	if (document.all.address.value == "" && document.all.email.value == "" && document.all.phone.value == "")
	{
		err=err+address+" "+or+" "+phone+" E-mail";
	}else{
		if (document.all.email.value!="")
		{
			if ((document.all.email.value.indexOf("@")==-1)||(document.all.email.value.indexOf(".")==-1))
			{
				err=err+email+"\n"
			}
		}
	}
	
	if (err!=pleasefill+":\n")
	{
		alert(err);
		return false;
	}else{
		return true
	}
}

function add_family()
{
	if(1!=1){
		alert ("        ");
	}else{
		open_win('modules/add_family.asp',275,200);
	}
}

function open_win(str,str2,str3)  //This function opens the window or focus on the window
{
	windowHandle=window.open( ""+str+"" , "Print" , "toolbar=no,status=no,scrollbars=no,dependent,resizable=yes,width="+str2+",height="+str3+",left=400,top=400" )
}

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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function getcity(qstring,where,target){
	qstring=qstring.replace(/ /g,"[sp]");
	var xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp2.Open("POST","modules/city.asp?rand="+ Math.random() ,false);
	xmlhttp2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlhttp2.send("qstring=" + qstring + "&target=" + target + "&where=" + where);
	document.getElementById(where).innerHTML=xmlhttp2.responseText;	
}

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_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 test(){
	jBox.open('jBoxID','inline','inline text','title','boxAttr');
}

////----- text for image in the gallery -----////
function showText(picID) {
	
	$.get("modules/picText.asp?id="+picID+"&rnd=" + Math.random(), function(data){
	
	var fc = $("#flashContaner").offset();
	//alert(fc.top);
	leftPos = (picID == 2)?fc.left+415:fc.left+360;
	//topPos = fc.top+175

//	$("#picTextDiv").html("<div>" + data + "</div>").openjBox("model=false,width=450,height=300,left=" + leftPos + ",top=" + topPos)
	$("#picTextDiv").html("<div class='text_div' style='left:" + leftPos + ";'>" + data + "</div>");
	has_scrollbar("contant");
});
}

function hideText() {
	//$("#picTextDiv").hidejBox();
	$("#picTextDiv").html("");
}

function has_scrollbar(elem_id){ 
	elem = document.getElementById(elem_id); 
	if (elem.clientHeight > elem.scrollHeight) $("#scrollDiv").hide();
		//alert("The element doesn't have a vertical scrollbar."); 
} 

////////-------------- scroll buttons -------------/////////

//function scrollDivDown(id){
//	document.getElementById(id).scrollTop+=1;
//	timerDown=setTimeout("scrollDivDown('" + id + "');",10);
//}
//	
//function scrollDivUp(id){
//	document.getElementById(id).scrollTop-=1;
//	timerUp=setTimeout("scrollDivUp('" + id + "');",10);
//}
//
//function stopscroll(id){
//	document.getElementById(id).scrollTop=document.getElementById(id).scrollTop;
//	timerDown=0//setTimeout("scrollDivDown('" + id + "');",0);
//	timerUp=0//setTimeout("scrollDivUp('" + id + "');",0);
//}
	var timerDown,timerUp;
	function scrollDivDown(obj){
		$("." +obj).scrollTo("+=2");
		timerDown=setTimeout("scrollDivDown('"+ obj + "');",20);
	}
	
	function scrollDivUp(obj){
		$("." +obj).scrollTo("-=2");
		timerUp=setTimeout("scrollDivUp('"+ obj + "');",20);
	}
	
////////--------- Auto complete --------------///////////

var xmlHttp
function showHint2(input_txt,output_rslt,str,primaryKey){
if(str.length<1){
	return;
}
  $.ajax({
    type: "POST",
    url: "/gethint.asp?sid=" + Math.random(),
    data: "q="+ str,
    success: function(html){
		$("#" + output_rslt).show();
		arr=html.split("^");
		$("#" + output_rslt).empty();
		for(i=0;i<arr.length-1;i++){
			var compName = arr[i].split("~")[0];
	 		var id=arr[i].split("~")[1];
        	$("#"+output_rslt).append("<span style='cursor:pointer' onclick=\"$('#" + input_txt + "').val($(this).text());$('#" + primaryKey + "').val("+ id +");$('#" + output_rslt + "').hide();\" onMouseOver=\"this.style.background='#dddddd'\" onMouseOut=\"this.style.background='#f9f9f8'\">" + compName + "</span><br/>");
		
		///	funStr = "<span style='cursor:pointer' onclick=\"comp=$(this).text().split('~');$('#" + input_txt + "').val(comp[0]);$('#" + output_rslt + "').hide();\" onMouseOver=\"this.style.background='#dddddd'\" onMouseOut=\"this.style.background='#ffffff'\">"
  		///	p=arr[i].split("~")
		///	funStr = funStr + p[0] + "</span><br/>"
		///	$("#"+output_rslt).append(funStr);
			
      	//	$("#"+output_rslt).append("<span style='cursor:pointer' onclick=\"$('#" + input_txt + "').val($(this).text());$('#" + output_rslt + "').hide();\" onMouseOver=\"this.style.background='#dddddd'\" onMouseOut=\"this.style.background='#ffffff'\">" + arr[i] + "</span><br/>");
      	}
    } 
  })
}

function showHint(str) {
	if (str.length==0){ 
	  document.getElementById("txtHint").innerHTML="";
	  return;
	}
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	  alert ("Your browser does not support AJAX!");
	  return;
	} 
	var url="gethint.asp";
	url=url+"?q="+encodeURI(str);
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
} 

function stateChanged() { 
	//When the state changes to 4 ("complete"), the content of the txtHint placeholder is filled with the response text.
	if (xmlHttp.readyState==4){ 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
	  // Internet Explorer
	  try {
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	  catch (e) {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	}
	return xmlHttp;
}

function fillField(str) {
	//alert(str);
	document.getElementById("txt1").value=str;
}

//--------------------- resize ----------------------//
function fixImg(p){
	var img = new Image();
	img.src = $("#mainPic").attr("src");

	var wTmp =img.width;
	var hTmp=img.height;
	
	var w1 = wTmp;
	var h1 = hTmp;
	
	if (wTmp>347){
		w1 = 347;
		hTmp = hTmp*w1/wTmp;
	}else{
		w1 = wTmp;
	}
	
	if (hTmp>265){
		h1 = 265;
		w1= w1*h1/hTmp;
	}else{
		h1 = hTmp;
	}
//	$("#gal_pic"+ p).width(w1);
//	$("#gal_pic"+ p).height(h1+15);
	$("#mainPic").width(w1);
	$("#mainPic").height(h1);
//	$("#mainPic").css({marginTop:(353-h1)/2});
//	$("#pic"+ p).css({left:(715-w1)/2});
//	$("#pic"+ p).css({marginTop:"15px"});
}


$(function(){
//	$(".galleryTN").width("58");
//	$(".galleryTN").height("34");
})


$("li").hover(function(){
	$(this).css('background', 'url(images/list-style-black.gif) left no-repeat');
	$(this).css('cursor', 'pointer');
})


//------ gallery menue position ---------//
$(function(){
	$("#galmenu").css('margin-left',271-$("#galmenu").width());
})

//------------- link from flash -----------//
function linkToPage(lnk) {
	switch(lnk){
	case 1: 
		//alert("0");
		window.location = "gallery.asp?sp=gal";
		//document.location.href('gallery.asp?sp=gal')
		break;

	case 2: 
		window.location = "BusinessDevelopment.asp";
		break;
	case 3: 
		window.location = "Entrepreneurship.asp";
		break;
	case 4: 
		window.location = "Manufacture.asp?sp=mf";
		break;
	case 5: 
		window.location = "creative.asp";
		break;
	case 6: 
		window.location = "Seminars.asp";
		break;
	case 7: 
		window.location = "xi-men.asp?id=1";
		break;
	case 8: 
		window.location = "contact.asp?sp=contact";
		break;

	default:window.location = "index.asp";
	}	
}

////----- text for image in the gallery -----////
function showImText(picID) {
	//alert(picID);
	$.get("picText.asp?id="+picID+"&rnd=" + Math.random(), function(data){
	$("#picTextDiv").html(data)
	//alert($("#picTextDiv").html(data));
});
}

////------- creativ image position ----////

function divJump() {
//$(function(){
	var fc = $(".creativeText").offset();
	//alert("top: " + fc.top + ", height: " + $(".creativeText").height())
	$(".creativeIMG").css('top',fc.top+$(".creativeText").height()+12);
}
//)