//powered by KOSOFT
//http://www.kosoft-studio.com

function MM_reloadPage(init) { 
  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);


function fshehstatusbarin(){
window.status='www.kosova-yp.com'
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=fshehstatusbarin
document.onmouseout=fshehstatusbarin


function isArray(com) {
	if (typeof(com.length) == "undefined") {
		return false;
	}
	else {
		return true;
	}
}

function isArraySelectBox(com) {
	if (typeof(com[0].length) == "undefined") {
		return false;
	}
	else {
		return true;
	}
}

function trim(str) {
	var strTrim = "";
	var i, j;
	
	if (isEmpty(str)) return strTrim;
	
	for (i=0; i<str.length; i++) {
		if (str.charAt(i) != " ") break;
	}
	for (j=str.length-1; j>=0; j--) {
		if (str.charAt(j) != " ") break;
	}
	
	strTrim = str.substr(i, j-i+1);
	return strTrim;
}

function isEmpty(str) {
	return ((str==null) || (str.length==0));
}

function isWhiteSpace(str) {
	return isEmpty(trim(str));
}

function isDigit(d) {
	return ((d >= "0") && (d <= "9"));
}

function isLetter(c) {
	return (((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")));
}

function isNumeric(strNum) {
	var i;
	
	if (isWhiteSpace(strNum) == true) {
		return false;
	}
	
	strNum = trim(strNum);
	
	for (i=0; i<strNum.length; i++) {
		var chr = strNum.charAt(i);
		if (!isDigit(chr)) {
			return false;
		}
	}
	return true;
}
function isInteger(s)
{   var i;

    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return false;
       else return (isInteger.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}

function isAlphaNumeric(strNum) {
	var i;
	
	if (isWhiteSpace(strNum) == true) {
		return false;
	}
	
	strNum = trim(strNum);
	
	for (i=0; i<strNum.length; i++) {
		var chr = strNum.charAt(i);
		if (!isDigit(chr) && !isLetter(chr)) {
			return false;
		}
	}
	return true;
}

function isAlphaOnly(strNum) {
	var i;
	
	if (isWhiteSpace(strNum) == true) {
		return false;
	}
	
	strNum = trim(strNum);
	
	for (i=0; i<strNum.length; i++) {
		var chr = strNum.charAt(i);
		if (!isLetter(chr)) {
			return false;
		}
	}
	return true;
}

function isRange(formObj, min, max)
{
	if(formObj.length < min || formObj.length > max)
	{
		return false;
	}
	return true;
}


function isEmail(s)
{   
	
	//alert(s); 
   	// is s whitespace?
    //if (isWhitespace(s)) return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++;
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++;
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else
	return true;
}

//Function to check whether the string is a valid integer
//Function to check whether the zipcode is a valid US zip code
function isZIPCode(field) 
{
	var valid = "0123456789";
	var hyphencount = 0;
	
	if (field.length!=5) {
	alert("Please enter your 5 digit zip code.");
	return false;
	}
	for (var i=0; i < field.length; i++) {
	temp = "" + field.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") {
	alert("Invalid characters in your zip code.  Please try again.");
	return false;
	}

	}
	return true;
}

function isMoney(str) 
{
	var valid = "0123456789.-"
	var temp;
	for (var i=0; i<str.length; i++) {
		temp = "" + str.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") 
			//ok = "no";
			return false;
	}
	return true;
}

function isPhoneNumber(str) 
{
	var valid = "0123456789()-"
	var temp;
	for (var i=0; i<str.length; i++) {
		temp = "" + str.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") 
			//ok = "no";
			return false;
	}
	return true;
}

function isCheckedRadio(objRadio) {
	checked = false;
	if (objRadio) {
		count = objRadio.length;
		if(count == 1) {
			checked = objRadio.checked;
		} 
		else {
			for(var i=0; i<count; i++) {
				if(objRadio[i].checked) {
					checked = true;
				}
			}
		}
	}
	return checked;
}

function getRadioVal(objRadio) {
	checked = false;
	if (objRadio) {
		count = objRadio.length;
		if(count == 1) {
			checked = objRadio.value;
		} 
		else {
			for(var i=0; i<count; i++) {
				if(objRadio[i].checked) {
					checked = objRadio[i].value;
				}
			}
		}
	}
	return checked;
}


function isSelected(frmObjSelect)
{
	if (frmObjSelect.value == -1) {
		return false;
	}
	else {
		return true;
	}
}



/* custom function for kosova-yp.com */
function toggle_over(el) {
	for(i=1; i<=11; i++) {
		eval("submenu"+i+".style").display = 'none';	
	}		
	el.style.display = '';
}
function toggle_out(el) {
	for(i=1; i<=11; i++) {
		eval("submenu"+i+".style").display = 'none';	
	}
	el.style.display = '';
}
function toggle_action(el) {
	if(el.style.display == '') {
		el.style.display = 'none';	
	} else {
		el.style.display = '';
	}
}

function popupWindow(page_url, width, height, opt) {
	popup_window = window.open(page_url,'popup_window','width='+width+',height='+height+','+opt);
	popup_window.focus();
}

function printWindow(page_url,width,height) {
	print_window = window.open(page_url,'popup_window','width='+width+',height='+height+',toolbar=0,location=0,directories=0,resizable=0,status=0,menubar=0,scrollbars=1');
	print_window.focus();
}


function imageWindow(boardname,id,width,height) {
	image_window = window.open('image_viewer1330.html?board='+boardname+'&id='+id,'image_window','width='+width+',height='+height+',toolbar=0,location=0,directories=0,resizable=0,status=0,menubar=0,scrollbars=1');
	image_window.focus();
}


function trim(inputString) {
     	if (typeof inputString != "string") { return inputString; }
 	var retValue = inputString;
   	var ch = retValue.substring(0, 1);
   	while (ch == " ") {
      		retValue = retValue.substring(1, retValue.length);
      		ch = retValue.substring(0, 1);
   		}
   	ch = retValue.substring(retValue.length-1, retValue.length);
   	while (ch == " ") {
      		retValue = retValue.substring(0, retValue.length-1);
      		ch = retValue.substring(retValue.length-1, retValue.length);
   		}
   	while (retValue.indexOf("  ") != -1) {
      		retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length);
   		}
   	return retValue;
	}

function checkSearch ( form ) {
	if (trim(form.criteria.value) == "") {
		form.criteria.focus();
		return false;
		}
	return true;
	}

function checkLogin(form) {
	if (trim(form.username.value) == "") {
		form.username.focus();
		return false;
		}
	if (trim(form.password.value) == "") {
		form.password.focus();
		return false;
		}
	return true;
	}

function checkCreate(form) {
	if (trim(form.username.value) == "") {
		form.username.focus();
		return false;
		}
	if (trim(form.email.value) == "") {
		form.email.focus();
		return false;
		}
	if (form.email.value != "") {
	        var email=form.email.value;
	        var check_space = email.indexOf(' ');
	        var check_ast = email.indexOf('@');
	        var check_dot = email.indexOf('.');
	        if ((check_space != -1) || (check_ast == -1) || (check_dot == -1)) {
		         form.email.focus();
		         return false;
		         }
		}
	if (trim(form.password1.value) == "") {
		form.password1.focus();
		return false;
		}
	if (trim(form.password2.value) == "") {
		form.password2.focus();
		return false;
		}
	if (trim(form.password1.value) != trim(form.password2.value)) {
		form.password1.focus();
		return false;
		}
	return true;
	}

function checkReset(form) {
	if (trim(form.email.value) == "") {
		form.email.focus();
		return false;
		}
	if (form.email.value != "") {
	        var email=form.email.value;
	        var check_space = email.indexOf(' ');
	        var check_ast = email.indexOf('@');
	        var check_dot = email.indexOf('.');
	        if ((check_space != -1) || (check_ast == -1) || (check_dot == -1)) {
		         form.email.focus();
		         return false;
		         }
		}
	return true;
	}

function checkResetVerify(form) {
	if (trim(form.code.value) == "") {
		form.code.focus();
		return false;
		}
	if (trim(form.pwd1.value) == "") {
		form.pwd1.focus();
		return false;
		}
	if (trim(form.pwd2.value) == "") {
		form.pwd2.focus();
		return false;
		}
	if (trim(form.pwd1.value) != trim(form.pwd1.value)) {
		form.pwd1.focus();
		return false;
		}
	return true;
	}

function checkReview(form) {
	if (trim(form.reviewText.value) == "") {
		form.reviewText.focus();
		return false;
		}
	return true;
	}

function checkContact(form) {
	if (trim(form.email.value) == "") {
		form.email.focus();
		return false;
		}
	if (form.email.value != "") {
	        var email=form.email.value;
	        var check_space = email.indexOf(' ');
	        var check_ast = email.indexOf('@');
	        var check_dot = email.indexOf('.');
	        if ((check_space != -1) || (check_ast == -1) || (check_dot == -1)) {
		         form.email.focus();
		         return false;
		         }
		}
	if (trim(form.question.value) == "") {
		form.question.focus();
		return false;
		}
	return true;
	}

function checkSubmission(form) {
	if (trim(form.newName.value) == "") {
		form.newName.focus();
		return false;
		}
	if (trim(form.newDescription.value) == "") {
		form.newDescription.focus();
		return false;
		}
	if (form.newEmail.value != "") {
	        var email=form.newEmail.value;
	        var check_space = email.indexOf(' ');
	        var check_ast = email.indexOf('@');
	        var check_dot = email.indexOf('.');
	        if ((check_space != -1) || (check_ast == -1) || (check_dot == -1)) {
		         form.newEmail.focus();
		         return false;
		         }
		}
	var selObj = form['newCategory[]'];
	var retVal = false;
	for (var i = 0; i < selObj.length; i++) {
		if (selObj.options[i].selected)	{
			retVal = true;
			}
		}
	if(retVal != true) {
        	return false;
		}
	return true;
	}

function checkEdit(form) {
	if (trim(form.newName.value) == "") {
		form.newName.focus();
		return false;
		}
	if (trim(form.newDescription.value) == "") {
		form.newDescription.focus();
		return false;
		}
	if (form.newEmail.value != "") {
	        var email=form.newEmail.value;
	        var check_space = email.indexOf(' ');
	        var check_ast = email.indexOf('@');
	        var check_dot = email.indexOf('.');
	        if ((check_space != -1) || (check_ast == -1) || (check_dot == -1)) {
		         form.newEmail.focus();
		         return false;
		         }
		}
	return true;
	}