var st=0;
var msgErr2 = new Array();
var maxL=10;
/*funksioni i cili fute te dhenat ne textarea textBox-eshte vlera apo stringu, contrl-eshte textarea, indx-eshte indeksi i vargut nese tekstBox eshte varg, tipi-i vili me 1 fute vleren e 
controlles e cila eshte ne alt atributin, ndersa me 2 fute tekstin i cili nuk eshte kontroll por eshte varg (Array)*/
function addRow(tekstBox,control,indx,tipi){
if ((control.value=="") || (control.value==null ))
{
	control.value+="Permirso gabimet";
	control.value+="\n\n";
}
	if(tipi==1)
	control.value+=tekstBox[indx].alt+"\n";
	if(tipi==2)
	control.value+=tekstBox[indx];
	if(tipi==3)
	control.value+=tekstBox;
	}

function ValidFild(){
if(document.getElementsByTagName){
var msgSummErr=document.getElementsByName("txtErrSumm");/*txtErrSumm eshte id-ja e textArea ku mesazhet paraqiten*/
var cont = document.getElementsByTagName("input");/*txtInput eshte id-ja e tekstbox-ave ne forme ku na nevoitet per ta marr mesazhin qe eshte shkruar ne "alt" atributin*/
var txtInp = new Array();
var txtMsg = new Array();

var j, rcount=0,p=0, q=0;

msgSummErr[0].value="";		/*behet bosh pershkak se nese thirrim disa here funksionin ateher dyfishohen te dhenat ne testarea*/
for(j=0;j<cont.length;j++)
{
	if((cont[j].className=="txtInput")){
			txtInp[p]=cont[j];
			p++;
			}
	if(cont[j].className=="msgErrInput"){
			txtMsg[q]=cont[j];
			if(st==0)/*ketu eshte kushti i cili nuk lejon nese st eshte e ndryshme prej 0 sepse vlerat te cilat ja japim msgErr2 fshihen*/
			msgErr2[q]=cont[j].alt;
			q++;
			}
}
st=1;/*ketu eshte i jipet ajo qe thash me heret pra if-i*/

for(j=0;j<p;j++){
if((txtInp[j].value=="") || (txtInp[j]==null)){
	txtMsg[j].value="*";
	if(msgErr2[j]!=txtMsg[j].alt)
	addRow(msgErr2,msgSummErr[0],j,2);
	
	addRow(txtMsg,msgSummErr[0],j,1);
	rcount++;
	if(txtMsg[j].alt.length>maxL)
		maxL=txtMsg[j].alt.length;		
	}
	else
	{
	txtMsg[j].value="";
	txtMsg[j].alt="";
	}
}


msgSummErr[0].cols=maxL+10;
msgSummErr[0].rows=rcount+2; /* numri i rreshtave ne tekstarea*/

for(j=0;j<p;j++)
if((txtInp[j].value=="") || (txtInp[j].value==null)){
	txtInp[j].focus();
	return false
	}
	
msgSummErr[0].value="";
return true
}
return false
}

function killBanners(){
var cont = document.getElementsByTagName("div");
var j;
for(j=0;j<cont.length;j++)
{
	if((cont[j].style.width != "")){
		cont[j].parentNode.removeChild(cont[j]);
		}
}
cont = document.getElementsByTagName("IFRAME");
for(j=0;j<cont.length;j++){
cont[j].parentNode.removeChild(cont[j]);
}
}

function ValidEmail(){
     var regex = /^(([\-\w]+)\.?)+@(([\-\w]+)\.?)+\.[a-zA-Z]{2,4}$/;
     if(regex.test(document.forms[0].txtEmail.value)){
     	 return true;
        }
        else{
       alert("Ju lutemi shtypeni Email-in tuaj ne menyre korrekte");
       document.forms[0].txtEmail.focus();
           return false;
        }
    }
function showWindow(myForm){
	if(myForm!=""){
	NewWin=window.open('','','width=300,height=200 resizable=yes,scrollbars=yes');
	NewWin.document.write(myForm);
	}else
	{alert("Ju lutemi shtypni vlera ne fushen Mesazhi");}
	}
