var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
		if (xmlhttp.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            xmlhttp.overrideMimeType('text/html');
         }
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}


function writeVideo(vid){
	//alert(vid);
	xmlhttp.open("GET", "/our_exclusive/vid.php?id="+vid,true);
	xmlhttp.onreadystatechange=function() {
		
  		if(xmlhttp.readyState==4) {
  			if(xmlhttp.status ==200){
  				videoPath = xmlhttp.responseText;
  				//alert(videoPath);
  				
  				takeaction(videoPath)
  			}
 		 }
 	}
 	xmlhttp.send('');
	
}
function takeaction(videoPath){
	document.getElementById('videocontainer').innerHTML ='<OBJECT ID="video1"  CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="200" WIDTH="260"><PARAM NAME="controls" VALUE="ImageWindow"><PARAM NAME="console" VALUE="video1"><PARAM NAME="autostart" VALUE="true"><PARAM NAME="src" VALUE="'+videoPath+'"><EMBED SRC="'+videoPath+'" NAME="video1"  TYPE="audio/x-pn-realaudio" WIDTH="260" HEIGHT="200" CONTROLS="ImageWindow" CONSOLE="two"></OBJECT>';	
}

function passReplace(){
	
pass=document.login.password.value;
user=document.login.username.value;
pattern = /^([a-zA-Z0-9_-])*$/;
			
			flag = pattern.test(user);
			flag2 = pattern.test(pass);
			
			if(!flag || user == ""){
				alert('Please enter your username.');
				document.login.username.focus();
				return false;
				}

			if(!flag2 || pass ==""){
				alert('please enter your password.');
				document.login.password.focus();
				return false;
			}
			else{
				pass=hex_md5(pass);			
				document.login.password.value=pass;
				return true;
			}
			
}

function validateContact(){
	var name = document.contact.name;
	var email= document.contact.email;
	var mobile = document.contact.mobile_phone;
	var contactType = document.contact.contact_type[document.contact.contact_type.selectedIndex].value;
	var subject = document.contact.artist[document.contact.artist.selectedIndex].value;
	var message = document.contact.message;

	
	if(name.value == ''){
		alert("please insert your name.");
		name.focus();
		return false;
	}
	if(email.value == ''){
		alert('Please insert a valid email address.');
		email.focus();
		return false;
	}
	if(mobile.value == ''){
		alert('Please insert your mobile number');
		mobile.focus();
		return false;
	}
	if(contactType == ''){
		alert('Please choose whom you wish to contact.');
		document.contact.contact_type.focus();
		return false;	
	}
	if(subject == ''){
		alert('Please choose your subject of contact.');
		document.contact.artist.focus();
		return false;	
	}
	if(message.value == ''){
		alert('Please insert your contact message.');
		message.focus();
		return false;		
	}
	
	
}

	function resetContact(){
	document.contact.name.value='';
	document.contact.email.value='';
	document.contact.mobile_phone.value='';
	document.contact.contact_type.options[0].selected = true;
	document.contact.artist.options[0].selected = true;
	document.contact.message.value='';	
		
		
		
	}
	function previewCatImage(imageURL,imageTitle){
	defaultWidth  = 500;
	defaultHeight = 500;
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
	var optIE='scrollbars=no,width=150,height=100,left=100,top=100';

	var AutoClose = true;

	if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
		var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left=100,top=100';
		var optIE='scrollbars=no,width=150,height=100,left=100,top=100';
		if (isNN){imgWin=window.open('about:blank','',optNN);}
		if (isIE){imgWin=window.open('about:blank','',optIE);}
		with (imgWin.document){
			writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
			writeln('<sc'+'ript>');
			writeln('var isNN,isIE;');
			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
			writeln('isNN=(navigator.appName=="Netscape")?1:0;');
			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
			writeln('function reSizeToImage(){');
			writeln('if (isIE){');
			writeln('window.resizeTo(100,100);');
			writeln('width=100-(document.body.clientWidth-document.images[0].width);');
			writeln('height=100-(document.body.clientHeight-document.images[0].height);');
			writeln('window.resizeTo(width,height);}');
			writeln('if (isNN){');
			writeln('window.innerWidth=document.images["Image"].width;');
			writeln('window.innerHeight=document.images["Image"].height;}}');
			writeln('function doTitle(){document.title="'+imageTitle+'";}');
			writeln('</sc'+'ript>');
			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
			else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
			writeln('<img name="Image" src='+imageURL+' style="display:block"></body></html>');
			close();
		}
}
